Looking at http://docs.python.org/2/library/subprocess.html#frequently-used-arguments I made the assumption that unless you use shell=True
, there is no ability to use rm
,cp
,mv
etc. Maybe the documentation is out-of-date as they are feeding the call method with a string, where it should be a list. But using shell=False
certainly doesn't prevent the usage of said shell commands.
shell=False disables all shell based features
After looking at subprocess.py, I can see that all that argument does is add ["/bin/sh", "-c"]
to the start of the argument string.
Can someone clarify this for me?
The shell features they are talking about are things like |
pipes, *
globs and other wildcards, stdout/stderr redirects with >
or 2>
, <(process substitution)
etc. They are not talking about other commands/programs such as mv, grep, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With