Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Sep 2006 10:58:39 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Arindam <arindam.mukerjee@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Korn Shell [[ ... ]] operator
Message-ID:  <20060925155839.GF73717@dan.emsphone.com>
In-Reply-To: <d85a51ff0609250831x76b9ff15j7c1c2d3e62976802@mail.gmail.com>
References:  <d85a51ff0609250831x76b9ff15j7c1c2d3e62976802@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 25), Arindam said:
> I know csh is the shell of choice on FreeBSD. But I have this question
> on Korn Shell and it would be great if somebody could explain.
> 
> Can someone tell me a little more about the Korn Shell [[ ... ]]
> double-brackets construct used for comparing string expressions. How
> does it differe from the standard [ ... ] single brackets.

Different comparison operators, basically, and faster than [ because it
doesn't have to fork /bin/[ .
 
> You could tell me to RTFM but I haven't gleaned enough clarity from
> such efforts already expended.

They're all documented in the manpage ("ksh93" for the shells/ksh93
ports), under Conditional Expressions.  Compare them with the "test"
manpage.  It looks like FreeBSD's test command does most of what ksh
does, except for the wildcard matching of =, which is handy but can be
emulated with a case statement :)

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060925155839.GF73717>