Skip to content

Instantly share code, notes, and snippets.

@bowei
Created April 10, 2017 17:56
Show Gist options
  • Save bowei/3f367af860bd364de8f65140c710c687 to your computer and use it in GitHub Desktop.
Save bowei/3f367af860bd364de8f65140c710c687 to your computer and use it in GitHub Desktop.
function foo() {
a=$1
shift
b=$1
shift
c=$1
shift
echo "a='${a}' b='${b}' c='${c}'"
}
x=
foo
foo 1
foo 1 2
foo 1 2 3
echo ====
foo "" 2
# Quoted args are not merged
foo "" "" 3
foo "" "" ""
# Empty string vars are empty and will be eaten...
foo ${x} ${x} "${x}z"
# Not if it is quoted...
foo "${x}" "${x}y" "${x}z"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment