I know about $*
, $@
, "$@"
and even ${1+"@"}
and what they mean.
I need to get access to the EXACT command-line arguments string from a shell script. Please pay attention to the quotes in the example. Anything like "$@" saves parameters but removes quotes and I don't see how to recover from this.
Example:
./my-shell.sh "1 2" 3
And I need to retrieve the EXACT parameter string without any processing:
"1 2" 3
Any idea how to achieve this?
In
bash
, you can get this from the shell history:Which works as you describe:
Also, here's a handy diagram: