Nasty little shell syntax problem for a Wizard

Robert Hartman hartman at ide.com
Wed Nov 21 11:04:45 AEST 1990


In article <2258 at megadon.UUCP> uunet!odetics!frank (Frank Merrow) writes:
>...
>I am running a command out of "make" so the condition code is important in what
>I am doing . . .
>
>Step 1
>
>gcc <parms> || (abort_script;exit 1)
>
>This statement lets me do some post processing when the compiler finds an error.
>
>Step 2
>
>gcc is generating a SINGLE warning message that I want to suppress, BUT I want
>the warning in all cases except for one VERY special one.  ...

[deleted discussion of options for getting around fact that return code from a
pipeline is that of the last command in the pipeline]

This seems like the wrong tack to me.  I'd suggest putting the code to filter
out the undesired instances of the error message in the post-processing script,
invoking it as follows:

	gcc ... 2>&1 gcc.out || (abort_script < gcc.out; exit 1)

Between make and the shell there are all sorts of clever things a person can
do.  However, it is often best not to (as anyone who's had to modify some of
_my_ early makefiles will agree).

-r



More information about the Comp.unix mailing list