Getting return code for a Python script invoked from a Linux shell script
Hi, folks, I have a Python script that is invoked by a shell script. I uses sys.exit() with a parameter within python. The calling script is using this line to get the return code: exit_code = !$ but it fails to get it. What's wrong here? (I am no Linux guru) Thanks in advance Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting return code for a Python script invoked from a Linux shell script
On Wed, 23 Sep 2009 09:51:29 -0700, volcano wrote: The calling script is using this line to get the return code: exit_code = !$ but it fails to get it. What's wrong here? (I am no Linux guru) Exit code is obtained with $?, not with !$ -- Igor Pozgaj | ipozgaj at gmail.com (GTalk / MSN) ICQ: 126002505 | http://fly.srk.fer.hr/~ipozgaj PGP: 0xEF36A092 | http://ipozgaj.blogspot.com fb, lfm, li, dA | http://twitter.com/ipozgaj -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting return code for a Python script invoked from a Linux shell script
On Wednesday 23 September 2009 18:51:29 volcano wrote: exit_code = !$ I think it's $? to get the code. \d -- home: http://otherwise.relics.co.za/ 2D vector animation : https://savannah.nongnu.org/projects/things/ Font manager : https://savannah.nongnu.org/projects/fontypython/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting return code for a Python script invoked from a Linux shell script
On Sep 23, 12:51 pm, volcano mark.gey...@gmail.com wrote: Hi, folks, I have a Python script that is invoked by a shell script. I uses sys.exit() with a parameter within python. The calling script is using this line to get the return code: exit_code = !$ but it fails to get it. What's wrong here? (I am no Linux guru) Thanks in advance Mark Assuming Bash, you'll want $? instead. The '!$' construct is used to pull the last argument of the previous command. Also, if I remember correctly, the history mechanism is disabled within shell scripts. -- Thanks, Jeff mcjeff.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting return code for a Python script invoked from a Linux shell script
On Sep 23, 8:01 pm, Donn donn.in...@gmail.com wrote: On Wednesday 23 September 2009 18:51:29 volcano wrote: exit_code = !$ I think it's $? to get the code. \d -- home:http://otherwise.relics.co.za/ 2D vector animation :https://savannah.nongnu.org/projects/things/ Font manager :https://savannah.nongnu.org/projects/fontypython/ Thanks to all who replied, actually, it was $! ( brain 'copy-paste' failure:) ) and $? did the job!!! -- http://mail.python.org/mailman/listinfo/python-list