The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Finding alternative code Lokesha UNIX for Advanced & Expert Users 0 02-06-2008 02:45 AM
Error code checking jepombar Shell Programming and Scripting 3 08-21-2007 02:50 PM
FD0 error code 30 Pritpal singh UNIX for Advanced & Expert Users 6 08-28-2006 06:55 AM
how to get error return code rayg50 Shell Programming and Scripting 2 01-13-2006 02:25 PM
http error code big123456 IP Networking 1 11-23-2005 08:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-14-2006
nitinkgoud nitinkgoud is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 19
Finding error code

Hi Guys,
Can you tell me how to find error code generated by a command.
Say i run a command and its generating an error how do i find out its error code ( i know its done using redirection operator.......but not sure how)?
  #2 (permalink)  
Old 07-15-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
The "$?" variable is equal to the error return of the previous program. You can remember this variable, print it out, or perform different actions based on various errors. You can use this to pass information back to the calling shell by exiting a shell script with the number as an argument. Example:

Code:
#!/bin/sh
# this is script1
exit 12

Then the following script

Code:
#!/bin/sh
script1
echo $?

would print 12.
  #3 (permalink)  
Old 07-15-2006
nitinkgoud nitinkgoud is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 19
Smile

Thanks a lot man.
Thanks for your help.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0