On Nov 8, 2011 1:01 PM, "Pandu Poluan" <pa...@poluan.info> wrote:
>
>
> On Nov 8, 2011 9:02 AM, "Claudio Roberto França Pereira" <
spide...@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,

Reply via email to