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.

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

# 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

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.