Re: `if $(cmd);' is a positive when there's no output from cmd
From:
Herculano Einloft
Subject:
Re: `if $(cmd);' is a positive when there's no output from cmd
Date:
Sat, 15 Apr 2006 23:44:14 -0300
Em (21:43:32), Mike Frysinger escreveu:
>On Saturday 15 April 2006 19:55, Herculano Einloft wrote:
>> $ if $(echo string >/dev/null); then echo true; fi
>> true
>>
>> This should be a syntax error, since
>>
>> $ if; then echo true; fi
>> bash: syntax error near unexpected token `;'
>
>the first command statement is more like:
>if :; then echo true; fi
>-mike
Hey mike..
Care to explain that? I still see a difference between
$ if $(echo :); then echo true; fi
which would be your example, and
$ if $(:); then echo true; fi
which would be mine
Regards