Computing.Net > Forums > Unix > Exit 4

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Exit 4

Reply to Message Icon

Name: vidyasri
Date: May 29, 2009 at 06:33:51 Pacific
OS: UNIX
Subcategory: General
Comment:

Could any one explain what is the meaning of exit 4 in UNIX shell script



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: May 29, 2009 at 09:10:01 Pacific
Reply:

The exit command sets the exit code in a calling shell script. Based on what happens in the child script, you can take some action in the parent.

Here is an example where parent.ss calls child.ss.

#!/bin/ksh

# parent.ss call child and look at exit code
./child.ss # execute the child
echo $? # should be 4
# end parrent.ss

# child.ss exit set to 4
exit 4
# end child.ss

There is a limit to the exit value. It's probably system dependent, but as I remember it's around 256. If it matters, you'll have to check.


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Exit 4

remove ^M from file www.computing.net/answers/unix/remove-m-from-file/6031.html

Command line arguments www.computing.net/answers/unix/command-line-arguments/6159.html

wildcards searching loopq www.computing.net/answers/unix/wildcards-searching-loopq/6917.html