Re: c programs & shell conditionals



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
.



Relevant Pages

  • Re: CFO: Why ./configure?
    ... Isn't it possible to write a shell script, ... AFAIK "make" also can include files, so that platform specific settings only ... are substituted in the created Makefile by e.g. ... software packages. ...
    (comp.os.linux.development.apps)
  • Re: Change the order start up applications
    ... Would a shell script still be the way. ... "Dave Patrick" wrote: ... > Dave Patrick ....Please no email replies - reply in newsgroup. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Setting the Priority Permanently???
    ... Thanks Dave, works great! ... > in your shell script. ... So is there an automatic way to set the priority ...
    (microsoft.public.win2000.general)
  • Re: Shell Scripts & permissions
    ... Dave from Dublin wrote: ... >I have been having a problem with a shell script I wrote. ... probably used a text editor that split the line because it was too long. ...
    (comp.unix.shell)
  • Re: Password Dictionary File/ Each Entry is 2 or 3 Words Concatenated?
    ... You can even implement it with a one-line shell script on almost any platform. ... Or Bash? ... need even more evidence that this is totally trivial? ...
    (comp.security.misc)