Re: c programs & shell conditionals
- From: dj3vande@xxxxxxxxxxxxxxxxxxxxxxxxxxx
- Date: Fri, 1 Feb 2008 15:37:35 +0000 (UTC)
In article <fnvdte$se2$1@xxxxxxxxxxxxxxxxx>, Hul Tytus <ht@xxxxxxxxx> wrote:
comp.lang.c
How is a unix shell script made to respond to the value returned
by a program compiled from c code?
The shell script below is my current effort, which doesn't work.
The c code shows what was used to generate a.out, seen in the shell script.
The value returned was varied from 0 to 1 for testing.
[re-ordered]
--- c program
int main(int argc, char **argv)
{
return 1; /* or return 0 or exit(0) or exit(1) */
}
Nothing wrong here, except that EXIT_FAILURE is probably better than 1
(though there's a good chance that the value of EXIT_FAILURE is in fact
1 on your platform).
---- shell script
# if [ `/net/u/12/b/br/unet/a.out` > 0 ]
if [ `/net/u/12/b/br/unet/a.out` > /dev/null ]
The people in comp.unix.shell will probably tell you that this line is
wrong.
dave
--
Dave Vandervies dj3vande at eskimo dot com
Their failure is not your excuse; time to find an unaverage pub.
--Richard Bos in the scary devil monastery
.
- Follow-Ups:
- Re: c programs & shell conditionals
- From: dbr
- Re: c programs & shell conditionals
- References:
- c programs & shell conditionals
- From: Hul Tytus
- c programs & shell conditionals
- Prev by Date: Re: A solution for the allocation failures problem
- Next by Date: Re: Executing and Monitoring External Programs
- Previous by thread: c programs & shell conditionals
- Next by thread: Re: c programs & shell conditionals
- Index(es):
Relevant Pages
|