From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RNemD-0003gZ-SC for garchives@archives.gentoo.org; Tue, 08 Nov 2011 06:03:18 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 95D7B21C037; Tue, 8 Nov 2011 06:03:04 +0000 (UTC) Received: from svr-us4.tirtonadi.com (svr-us4.tirtonadi.com [69.65.43.212]) by pigeon.gentoo.org (Postfix) with ESMTP id 8A62F21C023 for ; Tue, 8 Nov 2011 06:01:55 +0000 (UTC) Received: from mail-fx0-f53.google.com ([209.85.161.53]) by svr-us4.tirtonadi.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.69) (envelope-from ) id 1RNeks-0012eG-Uq for gentoo-user@lists.gentoo.org; Tue, 08 Nov 2011 13:01:55 +0700 Received: by faan15 with SMTP id n15so196816faa.40 for ; Mon, 07 Nov 2011 22:01:48 -0800 (PST) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.223.64.70 with SMTP id d6mr3805686fai.16.1320732108641; Mon, 07 Nov 2011 22:01:48 -0800 (PST) Received: by 10.223.74.16 with HTTP; Mon, 7 Nov 2011 22:01:48 -0800 (PST) Received: by 10.223.74.16 with HTTP; Mon, 7 Nov 2011 22:01:48 -0800 (PST) In-Reply-To: References: <1318397707.15637.3.camel@moriah> <20111012184927.44ed070b@toxic.dbnet> <20111013155058.52e870c3@rohan.example.com> <20111013163034.78a57a1f@rohan.example.com> Date: Tue, 8 Nov 2011 13:01:48 +0700 Message-ID: Subject: Re: [gentoo-user] "/usr/bin/[" and coreutils From: Pandu Poluan To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=00151748db782dd66004b132e8e7 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - svr-us4.tirtonadi.com X-AntiAbuse: Original Domain - lists.gentoo.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - poluan.info X-Archives-Salt: 78655abc-8f10-4e39-9229-493f868481b5 X-Archives-Hash: d3b318b3b9b8fc11358e45074abef614 --00151748db782dd66004b132e8e7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Nov 8, 2011 9:02 AM, "Claudio Roberto Fran=C3=A7a Pereira" wrote: > > What about [[? I've seen scripts using [[ instead of only one [. Whats the point/difference? AFAIK [[ was originally a bash-specific built-in command that provides more functionality than /bin/[, but can still use /bin/['s convoluted syntax. The two converged quickly, though. IIRC [ is now also a bash built-in, which still maintains compatibility with /bin/[ An example: [ $VAR ] will produce an error if VAR is empty or unset, but [[ $VAR ]] won't. (for the former, you have to put double quotes around, e.g., [ "$VAR"] ) Rgds, --00151748db782dd66004b132e8e7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Nov 8, 2011 9:02 AM, "Claudio Roberto Fran=C3=A7a Pereira" <= ;spideybr@gmail.com> wrote: >
> What about [[? I've seen scripts using [[ instead of only one [. W= hats the point/difference?

AFAIK [[ was originally a bash-specific built-in command that provides m= ore functionality than /bin/[, but can still use /bin/['s convoluted sy= ntax.

The two converged quickly, though. IIRC [ is now also a bash built-in, w= hich still maintains compatibility with /bin/[

An example:

[ $VAR ] will produce an error if VAR is empty or unset, but [[ $VAR ]] = won't.

(for the former, you have to put double quotes around, e.g., [ "$VA= R"] )

Rgds,

--00151748db782dd66004b132e8e7--