diff --git a/bash.md b/bash.md index 5939dd0..cbfe7c4 100644 --- a/bash.md +++ b/bash.md @@ -84,6 +84,18 @@ See: [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_ +### Optional arguments + +```bash +args=("$@") +args+=(foo) +args+=(bar) +baz "${args[@]}" +``` + +Put the arguments into an array and then append to the array. + + ### Functions ```bash