Some useful links on bash parameters: $1, $*, $@, quotes, etc.
Posted by jpluimers on 2016/06/22
Some notes with the links I found them:
- Always use
"$@"when passing on arguments to other processes: scripting – Propagate all arguments in a bash shell script – Stack Overflow. - Basically the use of
$*is very confined: Accessing bash command line args$@vs$*– Stack Overflow. $0is the command itself; it is not included in$@or$*: linux – Script parameters in Bash – Stack Overflow.- Passing on key-value pairs (either space or equals separated): How do I parse command line arguments in bash? – Stack Overflow.
- Great table from Handling positional parameters [Bash Hackers Wiki]:
| Syntax | Effective result |
|---|---|
$* |
$1 $2 $3 … ${N} |
$@ |
$1 $2 $3 … ${N} |
"$*" |
"$1c$2c$3c…c${N}" |
"$@" |
"$1" "$2" "$3" … "${N}" |
–jeroen






Leave a comment