From ce946dc97b38a720a8eb4980bbd43cd702e86614 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 9 Jan 2021 20:25:49 +0100 Subject: update bash/zsh notes --- src/tools/bash.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/tools/bash.md') 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 -- cgit v1.2.3