"Patrick" <[EMAIL PROTECTED]> wrote

I was just wondering if there was a way to return the results of a
python script to the bash shell?


Here is a silly pseudo code example:

bash command | some-python-script.py |  some.other-script.sh

That's called pipelining and uses standard input/output streams.

########## Untested! : echo.py #####

import sys

for line in sys.stdin:
   sys.stdout.write(line)

#########################

$ ls | python echo.py | wc -l

Should give much the same result as

$ ls | wc -l

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to