Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: john@iastate.edu (John Hascall)
Subject: Re: Having problems passing an exit() status to bourne shell
Date: 1997/02/01	[thread overview]
Message-ID: <5d037j$160$1@news.iastate.edu> (raw)
In-Reply-To: 32F25E2B.400C@idx.com


 Brian J. Krupski <krupski@idx.com> 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



      reply	other threads:[~1997-02-01  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-31  5:00 Having problems passing an exit() status to bourne shell Brian J. Krupski
1997-02-01  5:00 ` John Hascall [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox