the easiest but slowest way: you can send output to a file
ps -ef |grep emacs > output_file and then read the file content (I believe there is a much better way) On 9/2/07, herman <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to find out all the process id with the process name > 'emacs'. > > In the shell, i can do this: > > $ ps -ef |grep emacs > root 20731 8690 0 12:37 pts/2 00:00:09 emacs-snapshot-gtk > root 25649 25357 0 13:55 pts/9 00:00:05 emacs-snapshot-gtk rtp.c > root 26319 23926 0 14:06 pts/7 00:00:04 emacs-snapshot-gtk > stressTestVideo.py > root 26985 1 0 14:15 ? 00:00:01 /usr/bin/emacs-snapshot- > gtk > root 27472 21066 0 14:23 pts/5 00:00:00 grep emacs > > > and I can see the process id is 20731, 25649, etc, etc. > > But now I would like to do the programmically in my python script. > I know I can use ' os.system(cmd)' to execute the command 'ps -ef | > grep emacs', but how > can I pipe the output of my 'ps -ef | grep emacs' to my python script > and then run a regression expression with it to get the process Ids? > > Thank you. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Furkan Kuru -- http://mail.python.org/mailman/listinfo/python-list