FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-30-2010, 10:24 PM
bardo
 
Default for conditional checking when running in bash.

2010/7/1 Daenyth Blank <daenyth+arch@gmail.com>:
> On Wed, Jun 30, 2010 at 17:56, Thomas Bächler <thomas@archlinux.org> wrote:
>> Am 30.06.2010 23:47, schrieb Victor Lowther:
>>> It is worth 10 - 30% speedup whenever you want to compare something.
>>
>> Where do you get this from? I always used [ ], and I found it
>> sufficient. Why is [[ ]] faster?
>>
>>> -if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
>>> +if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then
>>
>> Why do you get rid of the quoting here? Quoting is nice.
>>
>>
>
> Quoting is not needed in [[ and it makes the code uglier.
>

Ditto. May I also suggest a link[1] to those that do not know all the
beauties of double square brackets? By the way, the whole BashFAQ in
there is really interesting, it has lots of advanced tips 'n tricks.

Corrado


[1] http://mywiki.wooledge.org/BashFAQ/031
 

Thread Tools




All times are GMT. The time now is 10:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org