Update bash.md

This commit is contained in:
Rico Sta. Cruz 2020-06-13 10:11:51 +10:00 committed by GitHub
parent 0361fa173b
commit bf22b55008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
(---
---
title: Bash scripting
category: CLI
layout: 2017/sheet
@ -211,9 +211,10 @@ echo ${STR^} #=> "Hello world!" (uppercase 1st letter)
echo ${STR^^} #=> "HELLO WORLD!" (all uppercase)
```
### Default values
| Expression | Description |
| ----------------- | -------------------------------------------------------- |
| `${FOO:-val}` | `$FOO`, or `val` if unset (or null) |
| `${FOO:=val}` | Set `$FOO` to `val` if unset (or null) |
| `${FOO:+val}` | `val` if `$FOO` is set (and not null) |
@ -221,7 +222,6 @@ echo ${STR^^} #=> "HELLO WORLD!" (all uppercase)
Omitting the `:` removes the (non)nullity checks, e.g. `${FOO-val}` expands to `val` if unset otherwise `$FOO`.
Loops
-----
{: .-three-column}