The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
what is meaning of exit(0) and exit(1) amitpansuria UNIX for Dummies Questions & Answers 1 08-28-2007 03:02 AM
exit(0) versus exit(1) enuenu High Level Programming 9 06-22-2007 10:56 AM
exit dhananjaysk Shell Programming and Scripting 2 04-06-2006 08:34 AM
Where can I find a list of exit codes? (Exit code 64) jkuchar747 UNIX for Dummies Questions & Answers 3 12-07-2004 06:08 PM
How to exit ssh davidg UNIX for Advanced & Expert Users 1 10-16-2003 07:10 AM

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

Join Date: Nov 2004
Location: Phoenix AZ
Posts: 11
Unhappy RE: exit value

I am running HP-UX & ksh

I have several validation programs that scan log files for error messages.

One of these files scan 3 diff files, thus I have the exit value in a variable and depending on which log-file I am scanning the value changes.
I am not getting the value I expect but a different value ( echo $? displays 213 - expect -777).
So my question is: Can you exit with a variable instead of a fixed value?

exit $xerr (where xerr=-777)
vs.
exit -777

THX in advance.
  #2 (permalink)  
Old 10-07-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
The exit value should be larger than what can be represented in eight bits: 0-127 signed or 0-255 unsigned.
Stick with numbers like 101, 102, 103

This is because unix wait strips all but the lowest eight bits from the return code before passing it to "$?"
Closed Thread

Bookmarks

Tags
exit, exit value

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 11:12 PM.


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