basic python-unix question

Rainy sill at optonline.net
Wed Jul 18 18:24:45 EDT 2001


On Wed, 18 Jul 2001 21:51:25 GMT, Ed T <spi at micro.soft> wrote:
> Hi Folks,
> New to Python and have been unable to us the "ps ef |grep" command
> correctly. From what I can tell I need to use the os.system() command. But
> have had no luck. Here an example of a basic script:
> 
> import os, sys
> process = ("test1", "test2")
> 
> for eachProcess in process:
>      os.system('ps ef | grep eachProcess')
change last line to
       os.system('ps ef | grep ' + eachProcess)

> 
> 
> The idea is to place processes that should be running into a for loop and
> see if it is running. When I do the above it appears only to check for the
> word "eachProcess" not for the process (i.e., test1 or test2). Is this a
> case of how to enter this command where substitution takes place in Python?
> What am I doing wrong?
> 
> Thanks in advance!
> 
> Ed
> 
> 


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline



More information about the Python-list mailing list