From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c9b1dae3c708de6c X-Google-Attributes: gidfee84,public X-Google-Thread: f678f,c9b1dae3c708de6c X-Google-Attributes: gidf678f,public X-Google-Thread: fc89c,c9b1dae3c708de6c X-Google-Attributes: gidfc89c,public X-Google-Thread: 1012a6,c9b1dae3c708de6c X-Google-Attributes: gid1012a6,public From: john@iastate.edu (John Hascall) Subject: Re: Having problems passing an exit() status to bourne shell Date: 1997/02/01 Message-ID: <5d037j$160$1@news.iastate.edu>#1/1 X-Deja-AN: 213748938 references: <32F25E2B.400C@idx.com> organization: Iowa State University, Ames, Iowa USA newsgroups: comp.unix.programmer,comp.unix.osf.misc,comp.unix.osf.osf1,comp.unix.shell Brian J. Krupski wrote: }I am launching a C program from a bourne shell script and trying to exit }the C program with an exit() status so that the bourne script can }interpret the exit status and take the appropriate action. However, it }only seems to work when I a exit(0). If I try to exit with a number }less than or greater than 0 the script interprets it as 255. }The code follows: } $program >/dev/null 2>&1 } status="$?" } echo $status 255 is returned on this line. }Any ideas???? Here's an example which works, perhaps it will be some help: eeyore.cc> cat > exit.c main() { exit(17); } /* exit(0..255) */ eeyore.cc> cc -o exit exit.c eeyore.cc> cat > exit.sh #!/bin/sh ./exit status="$?" echo $status eeyore.cc> chmod +x exit.sh exit.csh eeyore.cc> ./exit.sh 17 John -- John Hascall, Software Engr. Shut up, be happy. The conveniences you ISU Computation Center demanded are now mandatory. -Jello Biafra mailto:john@iastate.edu http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud