Seth W. Klein wrote:
That is, in the general case, broken due to quoting.  Try:

    if echo "$i" | grep -q groff ; then ... ; fi

(grep -q isn't portable, either, but you may not care.)

In any case, the following is portable and fast.  (Forks are expensive
and grep is never a builtin.)

    case $i in *groff) ... ;; esac

Sometimes it is nice that the ;; can be omitted if there is only one
case as in:

    case $i in *groff)
        .
        .
        .
    esac

Excellent. Thanks for the lesson, Seth. :) I'll definitely be looking at this again in the near future.

--
JH
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to