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 1RNeno-0004DR-9G for garchives@archives.gentoo.org; Tue, 08 Nov 2011 06:04:56 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 01BCC21C0C4; Tue, 8 Nov 2011 06:04:36 +0000 (UTC) Received: from svr-us4.tirtonadi.com (svr-us4.tirtonadi.com [69.65.43.212]) by pigeon.gentoo.org (Postfix) with ESMTP id D3D5E21C0AE for ; Tue, 8 Nov 2011 06:03:17 +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 1RNemD-0013AS-De for gentoo-user@lists.gentoo.org; Tue, 08 Nov 2011 13:03:17 +0700 Received: by faan15 with SMTP id n15so197715faa.40 for ; Mon, 07 Nov 2011 22:03:13 -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.75.129 with SMTP id y1mr2777987faj.1.1320732193264; Mon, 07 Nov 2011 22:03:13 -0800 (PST) Received: by 10.223.74.16 with HTTP; Mon, 7 Nov 2011 22:03:13 -0800 (PST) Received: by 10.223.74.16 with HTTP; Mon, 7 Nov 2011 22:03:13 -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:03:13 +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=0015174c1bee39148504b132ed23 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: 87c44afb-ace7-40b3-b0e5-c3800fd745d0 X-Archives-Hash: c357ce9deb2c397e062af0dca751a0d7 --0015174c1bee39148504b132ed23 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Nov 8, 2011 1:01 PM, "Pandu Poluan" wrote: > > > 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 [. 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"] ) > Uh... of course there should be a space between the second double-quote and the closing bracket. Rgds, --0015174c1bee39148504b132ed23 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Nov 8, 2011 1:01 PM, "Pandu Poluan" <pandu@poluan.info> wrote:
>
>
> On Nov 8, 2011 9:02 AM, "Claudio Roberto Fran=C3=A7a Pereira"= ; <spideybr@gmail.com> wrot= e:
> >
> > 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"] )
>

Uh... of course there should be a space between the second double-quote = and the closing bracket.

Rgds,

--0015174c1bee39148504b132ed23--