Need the difference between exit 1 & exit 7


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need the difference between exit 1 & exit 7
# 1  
Old 05-06-2013
Need the difference between exit 1 & exit 7

Hi

In one of the script I am seeing some thing like exit 7,exit 1,exit 2,exit 3,exit 9,exit6.What is the difference between all of this exit.Can anyone help here please
# 2  
Old 05-06-2013
The numbers are simply values that are being returned to the invoking process. What those particular numbers mean is implementation dependent except for 0 which means SUCCESS.
# 3  
Old 05-06-2013
An exit command upon terminating a script can also return a value to the parent script.

Usually SUCCESS is indicated by zero and FAILURE is indicated by non-zero exit codes.

As far I know an exit status should be an integer in 0 - 255 range. Out of which there are few exit codes with special meanings.

By the way we can program a script to return certain exit codes (in your case 1,2,3,6..) for different scenarios which will be available to parent and the parent can be programmed to handle each scenarios differently.

So there will be different set of actions taken when script returns 1,2,3,6 etc.
# 4  
Old 05-06-2013
Quote:
Originally Posted by ginrkf
In one of the script I am seeing some thing like exit 7,exit 1,exit 2,exit 3,exit 9,exit6.What is the difference between all of this exit.
0 means success, any nonzero number means some sort of error. There's no rigid standard for which number means what error, that's up to the program, but returning different numbers allows whatever calls it to tell the different errors apart.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Difference between exit, bye and quit in sftp

Hi All, I would like to know whether is there any difference in closing the sftp connection with exit, bye and quit. And would like to know the reliable command. (3 Replies)
Discussion started by: Girish19
3 Replies

2. Shell Programming and Scripting

LINUX - How to compare the values in 2 files & exit from the script

Hi All, I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further. For e.g : Scenario 1 In this case, the script should exit without proceeding further. Scenario 2 In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies

3. UNIX for Dummies Questions & Answers

Handling return & exit statements

I have 2 shell scripts the primary one would load the other one which will have functions defined in it. Script 1: . /apps/bin/Script 2 function if then continue... .... fi Script 2: function() (10 Replies)
Discussion started by: Ariean
10 Replies

4. Programming

difference between exit() and _exit()

By using exit() and _exit() we can terminate a program. What is the:confused: difference between these two ??? (4 Replies)
Discussion started by: lipun4u
4 Replies

5. UNIX for Dummies Questions & Answers

What does it mean and how do I do it: exit 0 fi ??

I use a Mac and need to 'echo' a code in >> /etc/hosts Where is: /etc/hosts? And how do I do : exit 0 Does : 'fi' mean something too? :confused:Thanks for any help, Jacqrav:confused: (1 Reply)
Discussion started by: jacqrav
1 Replies

6. Shell Programming and Scripting

difference b/t the exit codes $* and $@

I know that the exit codes in scripting "$*" will returns all the parameters/arguments passwd to the script. But I also know that "$@" will also returns the same. What is the difference between those two ? (1 Reply)
Discussion started by: praveen_b744
1 Replies

7. UNIX for Dummies Questions & Answers

what is meaning of exit(0) and exit(1)

can u tell me what is the meaning of exit(0),exit(1),exit(2) what is diff amonng these. Amit (1 Reply)
Discussion started by: amitpansuria
1 Replies

8. Programming

exit(0) versus exit(1)

What is the difference between using exit(0) and exit(1) to exit a program? Which should I use? (9 Replies)
Discussion started by: enuenu
9 Replies

9. Shell Programming and Scripting

stderr & stdout to a file and the right exit code

Hi all, I need to redirect stdout and stderr to a file in a ksh shell. That's not a problem. But I need also the correct exit code for the executed command. In the example below I redirect correctly the stdout & stderr to a file, but I have the exit code of tee command and not for the mv... (2 Replies)
Discussion started by: up69
2 Replies

10. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies
Login or Register to Ask a Question

Featured Tech Videos