add variable

remove the first or last string from variable
This commit is contained in:
onceupon 2018-04-12 14:34:29 +08:00 committed by GitHub
parent 54a00b2569
commit 2d890d0538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"