Skip to content

Instantly share code, notes, and snippets.

@laixintao
Created September 16, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laixintao/0fca9cb3f87f3cd5730ec02d41d90adf to your computer and use it in GitHub Desktop.
Save laixintao/0fca9cb3f87f3cd5730ec02d41d90adf to your computer and use it in GitHub Desktop.
Difference between $* and $@
echo "\$* in quotes..."
for v in "$*"
do
echo $v
done
echo "\$@ in quotes..."
for v in "$@"
do
echo $v
done
echo "\$* without quotes..."
for v in $*
do
echo $v
done
echo "\$@ without quotes..."
for v in $@
do
echo $v
done
# OUTOUT:
# $* in quotes...
# hello world
# $@ in quotes...
# hello
# world
# $* without quotes...
# hello
# world
# $@ without quotes...
# hello
# world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment