[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BUG??
From: |
PePa |
Subject: |
Re: BUG?? |
Date: |
Thu, 29 Dec 2016 21:43:54 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
Of course... My own stupidity.
It did raise the question for me, what would be the recommended way to
'group' expressions, where other languages would use brackets, like:
if (((q==1)) || [[ $r ]]) && grep -q $s $file
then
echo "$s is in $file, and either q is 1 or r is not empty"
fi
I guess this works, but it spawns a subshell. Is there a better way?
Thanks,
Peter
On 29/12/2559 08:38, Chet Ramey wrote:
> On 12/28/16 8:09 PM, Peter & Kelly Passchier wrote:
>> Is this a bug? These both output "q=1"
>>
>> q=1
>> [[ ((q==1)) ]] && echo q=1
>>
>> q=0
>> [[ ((q==1)) ]] && echo q=1
>>
>
> No. These both end up checking whether the length of the string "q==1" is
> non-zero, which it is.
>
- BUG??, Peter & Kelly Passchier, 2016/12/28