On Wed, Mar 05, 2008 at 07:32:38PM +0200, Jari Aalto wrote:
This is fine for interactive use, but not convenient in shell scripts,
because the outpur cannot be easily handles. Many times only the
integer value is needed:

        lines=$(wc -l $file)

        if [ $lines > $max ]; then           # ERROR!
           ... do something
        fi

In this case, I'd suggest simply doing lines=$(wc -l < file)

For other cases, it's so trivial to get the first column of whitespace delimited output in unix (or to simply cat some files to stdin and avoid the filename issue) that I just don't see the point.

Mike Stone



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to