Here's a trivial example using backquotes.  The tricky part is getting bash to 
use them in conditionals, variable assignments, and such.

0 % cat > /tmp/fie.py
print "Fie!"
[ctrl-d]
0 % cat > /tmp/echo.sh
echo `python /tmp/fie.py`
[ctrl-d]
0 % sh /tmp/echo.sh
Fie!
0 %

Cheers


On Wednesday 17 September 2008 11:30, Patrick wrote:
> I was just wondering if there was a way to return the results of a
> python script to the bash shell? I was thinking about using the output
> as an argumen for another shell command. I know that we can use the
> shell from within Python via the OS module but I believe this is usually
> used to feed input into the program.
>
> Here is a silly pseudo code example:
>
> bash command | some-python-script.py |  some.other-script.sh
>
> thanks in advance-Patrick
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to