help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Definitive answer of the difference between [ and [[


From: Peg Russell
Subject: Re: [Help-bash] Definitive answer of the difference between [ and [[
Date: Sat, 1 Feb 2014 22:22:38 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

> I'm wondering what the difference is between [ and [[. After reading
> the manual, it is not clearly to me that I know all the differences
> between them without missing anything. There are some online
> discussions. But they are not definitive. Does anyone have a
> definitive answer to this question? Thanks.

They are two ways to evaluate a bash expression. [ is a shell builtin (type
-a [) and is a synonym for the test builtin. [[ is a keyword (type -a [[).
Besides the man page and reference there is the help builtin command. To see
a brief list of operators valid for both, type: help test. I think the two
links below could be helpful. 

What is the difference between test, [ and [[ ?
http://mywiki.wooledge.org/BashFAQ/031

How to use double or single bracket, parentheses, curly braces
http://stackoverflow.com/questions/2188199/how-to-use-double-or-single-bracket-parentheses-curly-braces

Peg Russell




reply via email to

[Prev in Thread] Current Thread [Next in Thread]