Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36564

How to run multiline shell command within python

Date 2013-01-10 07:01 +0100
From Karim <kliateni@gmail.com>
Subject How to run multiline shell command within python
References <b1c7ea47-47b4-4784-8037-e0856fdaa7cd@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.365.1357797689.2939.python-list@python.org> (permalink)

Show all headers | View raw



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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 15:52 -0800
  Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database John Gordon <gordon@panix.com> - 2013-01-10 00:08 +0000
    Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 16:19 -0800
      Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database Mitya Sirenef <msirenef@lightbird.net> - 2013-01-09 20:07 -0500
      Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database MRAB <python@mrabarnett.plus.com> - 2013-01-10 01:11 +0000
        Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 18:20 -0800
          Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database Mitya Sirenef <msirenef@lightbird.net> - 2013-01-09 21:56 -0500
        Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 18:20 -0800
  How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 07:01 +0100
  Re: [Tutor] How to run multiline shell command within python Hugo Arts <hugo.yoshi@gmail.com> - 2013-01-10 09:31 +0100
  Re: [Tutor] How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 15:25 +0100
  Re: [Tutor] How to run multiline shell command within python Matty Sarro <msarro@gmail.com> - 2013-01-10 10:21 -0500
  Re: [Tutor] How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 20:07 +0100

csiph-web