Is there any existing utility that can parse a linux command line with recognition of basic piping and redirection: '|'
, '<'
, and, '>'
? Preferably this can be used for as parameters for a subprocess call instead of using os.system.
shlex.split()
does basic parsing, but its output cannot always be used by subprocess.Popen
like in this example:
sed -f script.sed < infile > outfile
Such a module would provide nothing that Popen with the shell=True option does not already provide.
See http://docs.python.org/library/subprocess.html#using-the-subprocess-module
It won't exist.
Hotwire seems like it can do this, this web page has some information on how this works.
IPython IPipe also has a different way to do some of the same things as Hotwire.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.