help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing returnvalues


From: Mike Shal
Subject: Re: testing returnvalues
Date: Mon, 22 Oct 2007 16:14:47 -0400

Hello,

On 10/22/07, k wayne <address@hidden> wrote:
> what i have ended up with ultimately, after quite a long time of
> testing, reading manuals and searching the web is the following:
>
> someTarget: dependencies
> <tab> if [ "`/bin/sh -c 'myCommand --options -asdf'`" -eq "5" ]; then fail fi
>
> however, that does not seem to work and i get an error saying that
> /bin/sh misses a fi.

It's not seeing the 'fi' because it's trying to pass 'fi' as an
argument to 'fail'. You need to end the 'fail' command with a
semicolon.
Eg:
if [ ... ]; then fail; fi

If you wanted to do if/then/else, it would be:

if [ ... ]; then foo; else bar; fi

Also, is there a reason you want to check against a particular return
value? Most commands return 0 on success, and anything else is a
failure. If you just want to stop make on a failure, it becomes quite
a bit easier to do if you follow that trend.

-Mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]