Re: [Tutor] Shell scripting

2008-09-17 Thread Chris Fuller
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 Sep

Re: [Tutor] Shell scripting

2008-09-17 Thread Chris Fuller
If you want the return code, there are at least two ways to do it. My zsh shell is configured to print the last return code in the prompt: 0 % python Python 2.4.4 (#2, Apr 15 2008, 23:43:20) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "lice

Re: [Tutor] Shell scripting

2008-09-17 Thread Alan Gauld
"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/outpu

Re: [Tutor] Shell scripting

2008-09-17 Thread Steve Willoughby
On Wed, Sep 17, 2008 at 12:30:58PM -0400, 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

[Tutor] Shell scripting

2008-09-17 Thread Patrick
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 i