[PLUG] bash test...

Michael Ewan mhewan1 at comcast.net
Sun Apr 24 03:46:34 UTC 2011


On 4/22/2011 8:42 PM, Russell Johnson wrote:
>
> On Apr 22, 2011, at 6:26 PM, Robert Citek wrote:
>
>> Works for me:
>>
>> $ EBS="/net/dbvol"
>>
>> $ if [ "${EBS}" == "/net/dbvol" ]; then echo yes ;else echo no ; fi
>> yes
>
> Making it a single equal sign resolved the issue.
>
> I am using bash 4.1.5 on Ubuntu 10.04.
>

That is the correct and portable method.  Remember that [ is an alias 
for 'test' and 'test' specifies a single equal for string equality. 
Bash may have a built in test, I haven't checked, just use the common 
'test' semantics.




More information about the PLUG mailing list