Colin Watson <[EMAIL PROTECTED]> [2003-01-05 13:46:32 +0000]:
> >   find . -maxdepth 1 -name '*.jpg' -print | head -n 1 | grep -q .
> 
> -q already stops at the first match, so there is no need to do this.

[I had to check.  ;-) The option -q sets done_on_match and the code
quits at the first chance it can.
  grep.c: line 497:
    static int done_on_match; /* Stop scanning file on first match */
]

Sweet!  I did not know that.  Thanks for educating me.

>   shall be the exit status of the last command specified in the pipeline

[Therefore I no longer need to worry about the last command that exits
versus the last command in the pipeline.]

I have some scripts that can be cleaned up and simplified.

Thanks again!
Bob

Attachment: msg22544/pgp00000.pgp
Description: PGP signature

Reply via email to