I have a few python scripts, and for various reasons, I have shell script wrapper around them:
#!/bin/sh
source env.sh
python $0.py $@
This works fine, unless the arguments needs to be quoted. In this case, of course, the wrapper, eats the quotes, and gives the un-quoted version to the python script. So, my first question is “How can I get sh to not eat the quotes?”
However, even if I back-slash the quotes, it doesn’t work. I print out the entire command I’m about to call:
source env.sh
echo "python $0.py $@"
python $0.py $@
If I call it with foo \”a b c” it outputs
python foo.py “a b c”
However, when foo.py gets called, it still GETS foo.py a b c
If I just copy and paste the output, and run it, it runs fine.
Can anyone tell me why the actual execution would fail from the script, but succeed on the command line?
thanks.
you need quotes around the actual use of the
$@parameter, i.e.I hope this helps.