I\'m constantly confused by the rules for quoting and evaluating when I\'m writing bash scripts. I know some of the basics, like the difference between \'\' and \"\" and ``,
At the shell prompt,
set -x
set -v
and create the following python program 'args.py'
#!/usr/bin/env python
import sys
print sys.argv
for arg in sys.argv[1:]:
for c in arg:
print c,"|",
print
Then experiment with command invocations like:
U=hello\ world ; V="-->$U<--"; W="1 $U 2 $V 3"; args.py $W
Until you realize that there is no logical way of thinking about what is going on. It really is all done by capricious magic shell pixies.