add variable

remove first leading zero
This commit is contained in:
onceupon 2018-04-12 14:05:49 +08:00 committed by GitHub
parent 99b7c30807
commit 394ef7c772
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -838,14 +838,18 @@ var="some string"
echo ${#var}
# 11
```
##### replacement (e.g. remove the first leading 0 )
```bash
${var[@]#0}
```
##### replacement (e.g. replace 'a' with ',')
```bash
{i/a/,}
{var/a/,}
```
##### replace all (e.g. replace all 'a' with ',')
```bash
{i//a/,}
{var//a/,}
```
```bash
#with grep