mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-26 06:17:01 +00:00
add variable
remove the first or last string from variable
This commit is contained in:
parent
54a00b2569
commit
2d890d0538
@ -844,6 +844,13 @@ var="some string"
|
|||||||
echo ${var%%"${var#?}"}
|
echo ${var%%"${var#?}"}
|
||||||
#s
|
#s
|
||||||
```
|
```
|
||||||
|
##### remove the first or last string from variable
|
||||||
|
```bash
|
||||||
|
var="some string"
|
||||||
|
echo ${var:2}
|
||||||
|
#me string
|
||||||
|
```
|
||||||
|
|
||||||
##### replacement (e.g. remove the first leading 0 )
|
##### replacement (e.g. remove the first leading 0 )
|
||||||
```bash
|
```bash
|
||||||
var="0050"
|
var="0050"
|
||||||
|
Loading…
Reference in New Issue
Block a user