Python code to replace shell scripts

Cameron Laird claird at
Thu Dec 11 23:02:02 CET 2003

In article <mailman.81.1071167444.9307.python-list at>,
Daven Nair <nair_260 at> wrote:
>I would like to know if Python supports codes similar to shell scripts:
>count=`ps -ef|grep "pattern"|wc -l`
>for count in `echo $count`
>  do
>  done
>Can I export a variable say var from os.system("var=`ps -ef|grep pattern|wc 
While I don't understand your questions, I suspect the series I've launched
with <URL: > will
interest you.

When you write, "Can I export a variable ...", are you asking that the
result of an external process be bound to a Python name (or variable), OR
that a Python process export a "shell" variable to its environment, OR

Cameron Laird <claird at>

More information about the Python-list mailing list