On Nov 8, 2011 9:02 AM, "Claudio Roberto França 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"] )
Rgds,