queries about exit


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting queries about exit
# 1  
Old 09-30-2008
Java queries about exit

hi all,

please tell me clearly the difference between
exit 1 and exit 2

one more question
i want to know the difference between some basic shells like bsh, csh, ksh, bash.

i refered in net i get wast of text pages can any one give me any link to show the diff precisely or any blogs.


Thanks.
# 2  
Old 09-30-2008
Hammer & Screwdriver

exit 1 and exit 2 both end a process. The difference is that they pass different values to the calling program. For example:

Code:
# main program commands
script_ar
if [ "$?" -ne 0 ]
   then
   echo "error returned from script_ar"
   if [ "$?" -eq 1 ]
      then
      echo "error 1 = bad filename"
   fi
   if [ "$?" -eq 2 ]
      then
      echo "error 2 = bad record count"
   fi
fi

The above main program calls script_ar. It analyzes the return value (the 1 or 2 you asked about). If the value is set, the program echo's an error and then specific error information that you designed into the routines.

It is normally good programming practice to use
exit 0
when ending a program that ran correctly
exit 1 (or other number)
when ending a program that had a problem
# 3  
Old 10-01-2008
so we are passing values in exit command as our need, jus like through and catch for any exception handling.

i got it Joe.
Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

RDNS Queries

Hey everyone, I have a question, I've been playing around with tcpdump, and noticed my machine making numerous rdns look ups. They are displayed like: 10.80.80.141.51234 > 10.80.80.1.domain: 9950+ PTR? 223.114.55.65.in-addr.arpa. (44) My question is, if dns works based on numerical... (0 Replies)
Discussion started by: Lost in Cyberia
0 Replies

2. AIX

Queries Regarding MigratePV

We have 3PVs, now we want to migrate it to new 2PVs. OLD PVS hdisk1 ---- /u01 hdisk2 ------ /u01 hdisk 3 ----- /u02, /u01 new PVs hdisk4 ---- Free hdisk5 ---- Free I check man, it doesn't say anything about offline/online thing, do i need downtime to migrate pv ? also, what i... (6 Replies)
Discussion started by: Fracker
6 Replies

3. Shell Programming and Scripting

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 (3 Replies)
Discussion started by: ginrkf
3 Replies

4. Red Hat

NFS Queries

Hi, I would like to know on one server how many mouting can be done? wheather there is limitation on number of mounting? wheather it is possible to increase NFS Performance? if yes then which parameters needs to given while mounting? (3 Replies)
Discussion started by: manoj.solaris
3 Replies

5. Homework & Coursework Questions

Queries

Any help on like where to get started on this? I'm just confused. 1. The problem statement, all variables and given/known data: Enter text here.Queries to satisfy these two report requests (use your CCI database): Retrieve all rows of active inventory where current on hands is less than... (0 Replies)
Discussion started by: lakers34kb
0 Replies

6. Shell Programming and Scripting

my queries

hi guys Well, i need to have a report generation script or any script which will show me all the content/information of a file when i run that script. Please help me on this isssue at the earliest.As i am little bit aware of scripting.Thanks in advance! regards ash (4 Replies)
Discussion started by: whizkidash
4 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. UNIX for Advanced & Expert Users

Some queries...

Guys need some advice on how to check some of the questions below? i'm running on an open VMS platform... which i am an idiot to... appreciate if anyone can give some hints or source on how to check on.. a script that is running on cron job... but doesn't run as the login user name.. 1. why... (6 Replies)
Discussion started by: 12yearold
6 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