Re: process result code in if

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

 



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.
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux