autoconf
[Top][All Lists]
Advanced

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

Re: process result code in if


From: Keith Marshall
Subject: Re: process result code in if
Date: Thu, 6 Jun 2013 14:25:44 +0100

On 6 June 2013 13:41, Eric Blake wrote:

> > A more robust, (and more portable), formulation may be:
> >
> >   echo $var | grep '^+\{0,1\}[0-9]\{1,\}$' > /dev/null 2>&1
>
> Why fork, when straight shell will do?
>
> case $var in
>   ...
>

Agreed, avoiding the fork is a good idea, and I do often use case
statements myself, much as you suggest, (although it may be considered
a less obvious solution).

My point was more that the OP's use of grep didn't use a particularly
effective expression for his (perceived) task, and that his use of
grep options wasn't portable.

-- 
Regards,
Keith.


reply via email to

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