How to pass shell variable to shell script from python

How to pass shell variable to shell script from python

Post by Christian » Thu, 28 Feb 2008 19:53:31



Don't use os.system or the popen functions. They have been substituted
with the subprocess module. It has a way to pass a new environment to a
process.

Christian
 
 
 

How to pass shell variable to shell script from python

Post by Gerardo He » Thu, 28 Feb 2008 20:17:21


Well, if you have to use os.system, that could be
os.system("export target=localhost.localdomain.org; ./callee.sh")

Gerardo

 
 
 

How to pass shell variable to shell script from python

Post by Philipp Pa » Thu, 28 Feb 2008 21:19:51


Or os.system("env target=localhost.localdomain.org ./callee.sh")

cu
Philipp

--
Dr. Philipp Pagel
Lehrstuhl f. Genomorientierte Bioinformatik
Technische Universit Mchen
http://www.yqcomputer.com/
 
 
 

How to pass shell variable to shell script from python

Post by D'Arcy J.M » Thu, 28 Feb 2008 22:56:34

On Wed, 27 Feb 2008 15:37:25 +0800


Side topic - if you want portability use the following:

#! /usr/bin/env python

--
D'Arcy J.M. Cain < XXXX@XXXXX.COM > | Democracy is three wolves
http://www.yqcomputer.com/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.