How to run multiline shell command within python

Karim kliateni at gmail.com
Thu Jan 10 07:01:24 CET 2013



Hello all,

I want to run multiline shell command within python without using a 
command file but directly execute several lines of shell.
I already use *subprocess.checkoutput("csh -f my_file.csh".split())* but 
I want to know if it is posssible to avoid making file and execute
shell lines of code directly.

Example:

cat<<EOF > myfile
echo "foo"
echo "bar"
...
EOF

Regards

Karim



More information about the Python-list mailing list