Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Setting paths with ~'s in values.
- X-seq: zsh-users 2184
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Danny Dulai <nirva@xxxxxxxxxxx>
- Subject: Re: Setting paths with ~'s in values.
- Date: Tue, 23 Feb 1999 21:07:56 -0800 (PST)
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxx
- In-reply-to: <19990223033938.20667@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199902122018.PAA29284@xxxxxxxxxxxxxxxxxx> <990212140558.ZM11520@xxxxxxxxxxxxxxxxxxxxxxx> <19990222172007.61479@xxxxxxxxxxxxxxxxx> <14034.13710.335334.486111@xxxxxxxxxxxxxxxxx> <19990223033938.20667@xxxxxxxxxxxxxxxxx>
- Reply-to: Bart Schaefer <schaefer@xxxxxxxxxxx>
Danny Dulai writes:
> what is the difference between [[ ... ]] and [ ... ] ?
`[[ ... ]]` is a lexical construct; in effect, `[[` and `]]` are
reserved words (though I don't recall if they're actually implemented
that way). `[` is just a command that happens to look for an argument
']', and interprets everything in between.
That means that the `...` in a `[[ ... ]]` expression can be treated
specially by the parser, so you can use things like `&&` and `||`
where `[` and `test` require -a and -o. In particular, the equality
test in a `[[`-expression uses pattern matching, so glob characters
in such expressions are not expanded against the filesystem. That's
what I've repeatedly been forgetting the last few weeks.
> Is [[ the builtin version of the test command?
No, `[` is the builtin version of `test`; but many of the conditional
expressions supported by `test` are also supported by `[[ ... ]]`,
which is the source of much of this confusion.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author