Python code to replace shell scripts
Cameron Laird
claird at lairds.com
Thu Dec 11 17:02:02 EST 2003
In article <mailman.81.1071167444.9307.python-list at python.org>,
Daven Nair <nair_260 at hotmail.com> wrote:
>Hi,
>
>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
>fi
>
>Can I export a variable say var from os.system("var=`ps -ef|grep pattern|wc
>-l`")
.
.
.
While I don't understand your questions, I suspect the series I've launched
with <URL: http://www.samag.com/documents/s=8964/sam0312a/0312a.htm > 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 phaseit.net>
Business: http://www.Phaseit.net
More information about the Python-list
mailing list