|
|||||||||
| Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here. |
unix and linux commands - unix shell scripting |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
return code of a unix command
How to find out whether the command I executed is successful or unsuccessful(at commandlinet)
Eg: say i execute the following command at command line rm * How do i find out whether my previous command is a success or failure. Thankyou. Best Regards, Ram. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Note: rm * can be very dangerous, be careful Code:
<some command> echo "$?" will display 0 if "some command" was successful. It will show 1 (or another non-zero number) if the command failed. Usually commands also display error messages when something goes wrong. |
| Sponsored Links | ||
|
|
![]() |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix return code example | khchong | Shell Programming and Scripting | 4 | 09-28-2011 03:33 AM |
| Managing awk return code over SSH command | maverick72 | Shell Programming and Scripting | 11 | 09-23-2011 05:23 AM |
| Return code of command assigned to variable | browndr | Shell Programming and Scripting | 2 | 08-05-2008 09:26 AM |
| to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's | manas6 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 07:44 AM |
| Move command return with exit code of 2 | handak9 | UNIX for Advanced & Expert Users | 1 | 08-26-2004 06:40 AM |
|
|