1 |
On Nov 8, 2011 1:01 PM, "Pandu Poluan" <pandu@××××××.info> wrote: |
2 |
> |
3 |
> |
4 |
> On Nov 8, 2011 9:02 AM, "Claudio Roberto França Pereira" < |
5 |
spideybr@×××××.com> wrote: |
6 |
> > |
7 |
> > What about [[? I've seen scripts using [[ instead of only one [. Whats |
8 |
the point/difference? |
9 |
> |
10 |
> AFAIK [[ was originally a bash-specific built-in command that provides |
11 |
more functionality than /bin/[, but can still use /bin/['s convoluted |
12 |
syntax. |
13 |
> |
14 |
> The two converged quickly, though. IIRC [ is now also a bash built-in, |
15 |
which still maintains compatibility with /bin/[ |
16 |
> |
17 |
> An example: |
18 |
> |
19 |
> [ $VAR ] will produce an error if VAR is empty or unset, but [[ $VAR ]] |
20 |
won't. |
21 |
> |
22 |
> (for the former, you have to put double quotes around, e.g., [ "$VAR"] ) |
23 |
> |
24 |
|
25 |
Uh... of course there should be a space between the second double-quote and |
26 |
the closing bracket. |
27 |
|
28 |
Rgds, |