Let\'s say I have a really simple shell script \'foo\':
#!/bin/sh
echo $@
If I invoke it like so:
foo 1 2 3
>
First, you probably want quoted version of $@, i.e. "$@". To feel the difference, try putting more than one space inside the string.
Second, quotes are element of shell's syntax -- it doesn't do you a favor. To preserve them, you need to escape them. Examples:
foo 1 "\"this arg has whitespace\"" 3
foo 1 '"this arg has whitespace"' 3