Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Having problems passing an exit() status to bourne shell
@ 1997-01-31  5:00 Brian J. Krupski
  1997-02-01  5:00 ` John Hascall
  0 siblings, 1 reply; 2+ messages in thread
From: Brian J. Krupski @ 1997-01-31  5:00 UTC (permalink / raw)



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????


Brian Krupski



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Having problems passing an exit() status to bourne shell
  1997-01-31  5:00 Having problems passing an exit() status to bourne shell Brian J. Krupski
@ 1997-02-01  5:00 ` John Hascall
  0 siblings, 0 replies; 2+ messages in thread
From: John Hascall @ 1997-02-01  5:00 UTC (permalink / raw)



 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-02-01  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox