Merge pull request #1136 from xvazquezc/patch-2
upper/lowercase manipulation
This commit is contained in:
commit
3c76e512a6
13
bash.md
13
bash.md
|
@ -199,6 +199,19 @@ comment
|
||||||
|
|
||||||
| `${#FOO}` | Length of `$FOO` |
|
| `${#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
|
### Default values
|
||||||
|
|
||||||
| `${FOO:-val}` | `$FOO`, or `val` if not set |
|
| `${FOO:-val}` | `$FOO`, or `val` if not set |
|
||||||
|
|
Loading…
Reference in New Issue