Xref: utzoo comp.unix.questions:13695 comp.sys.sequent:277 Path: utzoo!attcan!uunet!mcvax!ukc!icdoc!syma!andy From: andy@syma.sussex.ac.uk (Andy Clews) Newsgroups: comp.unix.questions,comp.sys.sequent Subject: Possible Sh bug? Keywords: SUN4, Sequent S81 Message-ID: <1002@syma.sussex.ac.uk> Date: 17 May 89 16:06:51 GMT Organization: University of Sussex Lines: 40 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@syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk@uk.ac Voice: +44 273 606755 ext.2129