return a value to shell script
news123 at free.fr
Fri Nov 14 22:01:42 CET 2008
I don't know what exactly your python script is doing and what kind of
return value you have,
Let's assume your python application prints nothing to stdout, then
python could print out the return value and you could get it with the
back ticks (reverse single quote)
(at least for sh bash csh tcsh and probably also for ksh and some others)
>>>>>>>>>> beginning of python script numtotext.py
b = int(sys.argv)
###your python script can still print to stderr if it likes to
print >> sys.stderr, "I am no converting"
result = a[b]
>>>>>>> end of python script
>>>>>beginning of shell script
text=`python numtotext.py $num`
echo "$num as text is $text"
>>>>> end of shell script
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.
More information about the Python-list