![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exit Codes | cmschube | Shell Programming and Scripting | 1 | 04-04-2008 08:34 AM |
| bash awk codes to perl | phamp008 | Shell Programming and Scripting | 1 | 03-15-2008 02:11 AM |
| difference b/t the exit codes $* and $@ | praveen_b744 | Shell Programming and Scripting | 1 | 09-19-2007 06:53 AM |
| Where can I find a list of exit codes? (Exit code 64) | jkuchar747 | UNIX for Dummies Questions & Answers | 3 | 12-07-2004 03:08 PM |
| exit codes | donna carter | High Level Programming | 3 | 05-31-2001 06:35 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to get exit status codes in bash from Perl?
I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query.
If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement. Thanks, Siegfried |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
echo "${?}"
|
|
#3
|
|||
|
|||
|
To expand, all unix shells set a particular variable '$?' to the the exit status of the command just completed. So in your case:
Code:
my_perl_prog.pl if [ $? -eq 33 ] then <do something> fi |
|
#4
|
|||
|
|||
|
web page for bash documentation?
OK thanks! $? is for the return status code, $! is for PID. Is there a web page where these single character variables are documented? How about a man and info page too?
This is beginning to look a lot like perl. I bet $$ is the current PID. Thanks, Siegfried |
|
#5
|
||||
|
||||
|
Under man sh, section Special Parameters
Under man ksh, section Parameters |
|
#6
|
|||
|
|||
|
man <your shell name>
for example man bash man ksh man sh should tell you all you need to know ... and strictly speaking it's perl that looks like the shells not the other way round :-). Otherwise google should return a wealth of information |
|||
| Google The UNIX and Linux Forums |