Possible Sh bug?
Andy Clews
andy at syma.sussex.ac.uk
Thu May 18 02:06:51 AEST 1989
Compare the following 'sh' commands on a Sequent Symmetry S81 (DYNIX
3.0.12) and a Sun4 (SunOS 4.0). Both Sh's were fired off from an
interactive Csh:
Symm. S81
---------
% sh
$ echo $?
0
$ if [ $? != 0 ]; then exit 1; fi
$ echo $?
1
Sun4
----
% sh
$ echo $?
0
$ if [ $? != 0 ]; then exit 1; fi
$ echo $?
0
Why the different value of $? at the end of each example? Which system
is at fault? Or are they both wrong :-) :-)
What exit status (value) should the "if" return? My understanding is
that "exit" only works in non-interactive shells (see man sh(1)), but
surely in the above, it shouldn't get as far as the "exit" anyway
because $? is 0.
I would welcome any help from the net before I start accusing either
Sequent or Sun.
Thanks.
--
Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, ENGLAND
JANET: andy at syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk at uk.ac
Voice: +44 273 606755 ext.2129
More information about the Comp.unix.questions
mailing list