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