Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [[ and [



To expand on Bart's reply the "if [ ]" form goes back to the original
Bourne shell (probably before you were born but not before I was born :-)
which only supported invoking external programs and evaluating their exit
status. The left square-bracket was actually a filesystem alias for
/bin/test (or /usr/bin/test). Although today it is more likely that both
the "[" and "test" commands are built-ins to the shell that exhibit the
historic semantics. Whereas "[[" is a token that triggers the shell to
parse the contents up to the matching "]]" using different rules. I believe
the "[[ ]]" notation was introduced by the Korn shell after David Korn who
wrote the first version.

On Sat, Mar 3, 2012 at 6:36 PM, sergio <mailbox@xxxxxxxxxxxxx> wrote:

> Hello.
>
> It's dumb question, but I can't find this in man.
>
> What it the difference between [[ ]] and [ ]?
> if [[ ]]; then ... fi
> and
> if [ ]; than ... fi
>
> OK, the first is an evaluating of the conditional expression, and what
> is the second?
>
> --
> sergio.
>



-- 
Kurtis Rader
Caretake of the exceptional canines Einstein and Chino


Messages sorted by: Reverse Date, Date, Thread, Author