os.execv

Erik Max Francis max at alcyone.com
Wed Mar 5 17:49:16 EST 2003


Nick Coghlan wrote:

> I don't have an interpreter handy, but wouldn't the version below
> achieve the
> 'split literal on whitespace" effect?
> 
>  >>> os.execv("/usr/bin/find", *"find / -name test".split())

It would.  Provided each argument contained no whitespace.  But since
they might, expecting Python to chop up the spaces right essentially
amounts to demanding that your Python does all the quoting functionality
of a shell.  But the whole point here is invoking the shell, not
emulating it.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ It's a man's world, and you men can have it.
\__/ Katherine Anne Porter
    The laws list / http://www.alcyone.com/max/physics/laws/
 Laws, rules, principles, effects, paradoxes, etc. in physics.




More information about the Python-list mailing list