test the exit status inside a shell

Paul Bush pbush at necis.UUCP
Thu Sep 29 22:25:56 AEST 1988


In article <3741 at boulder.Colorado.EDU> wu at spot.Colorado.EDU (WU SHI-KUEI) writes:
>In article <5651 at sgistl.SGI.COM> larry at sgistl.SGI.COM (Larry Autry) writes:
>>Is there a way to test the exit status of the previously executed process
>>while in a shell?  In other words, if the previous program returned an exit
>>status of (2) (or even (0)), then perform something based upon that return 
>>value.
>
>The shell variable $? is set to the exit status of the last executed command.
>



The above variable '$?' works fine for the Bourne shell (sh).  The
equivilant C-shell variable is '$status'.

Good Luck
Paul Bush
(necis!pbush)



More information about the Comp.unix.questions mailing list