return a value to shell script

D'Arcy J.M. Cain darcy at druid.net
Wed Nov 12 08:19:32 EST 2008


On Wed, 12 Nov 2008 13:09:21 +0000
Tom Wright <tew24 at spam.ac.uk> wrote:
> devi thapa wrote:
> > I am executing a python script in a shell script.  The python script
> > actually returns a value.
> > So, can I get the return value in a shell script? If yes, then help me
> > out.
> 
> Yes.  The variable $? should be bound to the return value of the last
> foreground program to exit.  The python script can return a value using
> sys.exit(value)

That may be true for some shells but not all.  The correct answer to
the OP's question is - check the documentation for your specific shell
or ask on a group dedicated to the shell you are using.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list