upper/lowercase manipulation

This commit is contained in:
xvazquezc 2019-07-05 15:30:00 +10:00 committed by GitHub
parent c706d50ca4
commit b3e81e0da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

13
bash.md
View File

@ -199,6 +199,19 @@ comment
| `${#FOO}` | Length of `$FOO` |
### Manipulation
```bash
STR="HELLO WORLD!"
echo ${STR,} #=> "hELLO WORLD!" (lowercase 1st letter)
echo ${STR,,} #=> "hello world!" (all lowercase)
STR="hello world!"
echo ${STR^} #=> "Hello world!" (uppercase 1st letter)
echo ${STR^^} #=> "HELLO WORLD!" (all uppercase)
```
### Default values
| `${FOO:-val}` | `$FOO`, or `val` if not set |