Created
April 27, 2017 11:28
-
-
Save jmorahan/315c3838b7685511ff340f7ad3a9dbb6 to your computer and use it in GitHub Desktop.
bash script default parameters variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -a DEFAULTS PARAMS | |
DEFAULTS=(foo bar "baz quux") | |
PARAMS=("${@:-${DEFAULTS[@]}}") | |
printf "%s\n" "${PARAMS[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment