Improve 'get the first character of variable

Thanks to Masta's command on Reddit
This commit is contained in:
I-Man Ng 2019-05-09 15:41:47 +08:00 committed by GitHub
parent e553be01fc
commit c2fc594db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1018,9 +1018,13 @@ echo ${#var}
```
##### get the first character of the variable
```bash
var="some string"
var=string
echo "${var:0:1}"
#s
#or
echo ${var%%"${var#?}"}
#s
```
##### remove the first or last string from variable
```bash