Skip to content

Instantly share code, notes, and snippets.

@hraban
Last active August 23, 2017 10:48
Show Gist options
  • Save hraban/3980d73ac78dfdc0f9112b6e6dfd39a2 to your computer and use it in GitHub Desktop.
Save hraban/3980d73ac78dfdc0f9112b6e6dfd39a2 to your computer and use it in GitHub Desktop.
(bash) Comparing $* and $@
$ /tmp/test.sh
$*: []
"$*": ['']
$@: []
"$@": []
$ /tmp/test.sh a b "c d"
$*: ['a', 'b', 'c', 'd']
"$*": ['a b c d']
$@: ['a', 'b', 'c', 'd']
"$@": ['a', 'b', 'c d']
#!/bin/bash
echo -n '$*: ';
python -c 'print __import__("sys").argv[1:]' $*
echo -n '"$*": ';
python -c 'print __import__("sys").argv[1:]' "$*"
echo -n '$@: ';
python -c 'print __import__("sys").argv[1:]' $@
echo -n '"$@": ';
python -c 'print __import__("sys").argv[1:]' "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment