The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
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 03:44 AM
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 09:33 AM
Shell script to catch PL/SQL return values Veera_Raghav Shell Programming and Scripting 0 06-26-2006 02:16 PM
perl "system" cmd return values.. sekar sundaram Shell Programming and Scripting 0 11-24-2005 05:00 AM
exit/return values vslewis UNIX for Dummies Questions & Answers 1 11-17-2004 12:12 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-03-2006
Registered User
 

Join Date: Oct 2003
Location: Brazil
Posts: 42
Possible return values for $?

I think the $? returns 0 if the last issued command was successful and otherwise if not. But does anyone knows the value list that may be returned ? (or it is only zero/one ? )

Thanks in advance,
Abrahao.
Reply With Quote
Forum Sponsor
  #2  
Old 01-03-2006
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
That depends on the program you have run. Return codes are usually listed in the man pages.
Reply With Quote
  #3  
Old 01-03-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
you can get a list from

/usr/include/sys/errno.h
Reply With Quote
  #4  
Old 01-03-2006
Registered User
 

Join Date: Jan 2006
Location: india
Posts: 29
suggestion

the $? will return the exit code of the previous command executed....

the value depends on the success of the last command...

0 is always used to denote a success

other values depend on the type of error....


example: in a cp command if the source file is not found, it will give a non-zero erro and if destination is not found, it will give another non-zero error value... so depending on the value returned, we can find out the error occured
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0