diff options
Diffstat (limited to 'src/tools/bash.md')
-rw-r--r-- | src/tools/bash.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/bash.md b/src/tools/bash.md index 3f53045..201a6ad 100644 --- a/src/tools/bash.md +++ b/src/tools/bash.md @@ -16,9 +16,12 @@ ### Parameter ```bash -# default param +# default value bar=${foo:-some_val} # if $foo set, then bar=$foo else bar=some_val +# alternate value +bar=${foo:+bla $foo} # if $foo set, then bar="bla $foo" else bar="" + # check param set bar=${foo:?msg} # if $foo set, then bar=$foo else exit and print msg |