sys.argv with quoted strings as option argument

Heike C. Zimmerer usenet03q2 at hczim.de
Thu Dec 11 17:10:13 EST 2003


Satya Arjunan <satya at ttck.keio.ac.jp> writes:

[args are re-parsed by sh:]
> satya at kona printargs $ cat sh-python
> #!/bin/sh
> echo /usr/bin/python $*
> exec /usr/bin/python $*
>
> satya at kona printargs $ ./printargs.py --libdir="/usr/lib /usr/local/lib"
> /usr/bin/python ./printargs.py --libdir=/usr/lib /usr/local/lib
> ['./printargs.py', '--libdir=/usr/lib', '/usr/local/lib']

You might want to use "$@" (including the double quotes) instead of $*
to avoid splitting of the arguments at the intervening white space.

- Heike




More information about the Python-list mailing list