LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2007, 01:52 AM   #1
vedanu
LQ Newbie
 
Registered: Feb 2007
Location: Bangalore
Distribution: Fedora
Posts: 18

Rep: Reputation: 0
Question Exit status


Hello ...,

I have noticed in some programs... there will be an exit statement to terminate the application.

like
Quote:
exit(0),exit(1),exit(30)...
what does these numbers actually means... does it make any difference in using different status number
can any one list the exit status number and the meaning or the actual usage of the exit status number.
 
Old 06-23-2007, 02:41 AM   #2
nc3b
Member
 
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
The exit status is relative to every program (that is it can mean different things for different programs).

It is used primarily to determine the exit reason, the exit conditions, and error etc. For instance, in the unix world, an exit 0 usually means success, the program performed and exited without problems. exit 1 means some problem occurred. To see the exit status of a program type echo $? just after running it.

Last edited by nc3b; 06-24-2007 at 03:43 AM.
 
Old 06-23-2007, 02:55 AM   #3
vedanu
LQ Newbie
 
Registered: Feb 2007
Location: Bangalore
Distribution: Fedora
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nc3b
To see the exit status of a program type echo $? just after running it.
I am able to see 30 or 99 .. when I type echo $? after I run the application
But I want to know what does it actually mean to the programmer... while giving the status
 
Old 06-23-2007, 09:35 AM   #4
nc3b
Member
 
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
Well, you could ask the programmer, read the sourcecode or read some documentation. How else did you think you could find the meaning of the exit status?
 
Old 06-23-2007, 05:13 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Here's a neat thing you can do if you can't find a list.

Open up python (if you have it, if not, install it, it's very useful), and run this:

Code:
import os
os.strerror(0)
Instead of 0, you can put any error code. These are the standard error codes ... some programmers may not abide by them ...

error code 0 is, of course 'Success'
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
> Ftp With Exit Status, Ftp with exit status vwvr9 Linux - General 4 02-23-2005 02:53 AM
exit status naflan Programming 2 10-22-2004 12:22 PM
exit status 17 kppp joshy Mandriva 3 10-08-2004 07:07 AM
pppd exit status 1 wolfe2554 Linux - Networking 2 04-14-2004 12:15 AM
gcc exit status 1 Daddio Linux - Software 4 10-25-2003 05:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration