zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@tiny.zanshin.com>
To: Danny Dulai <nirva@ishiboo.com>
Cc: Bart Schaefer <schaefer@zanshin.com>, zsh-users@sunsite.auc.dk
Subject: Re: Setting paths with ~'s in values.
Date: Tue, 23 Feb 1999 21:07:56 -0800 (PST)	[thread overview]
Message-ID: <14035.35116.392298.579759@c-bart.amazon.com> (raw)
In-Reply-To: <19990223033938.20667@bleep.ishiboo.com>

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.


      reply	other threads:[~1999-02-24  5:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-12 20:17 Larry P . Schrof
1999-02-12 22:05 ` Bart Schaefer
1999-02-12 22:29   ` Bart Schaefer
1999-02-22 22:20   ` Danny Dulai
1999-02-23  4:58     ` Bart Schaefer
1999-02-23  8:39       ` Danny Dulai
1999-02-24  5:07         ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14035.35116.392298.579759@c-bart.amazon.com \
    --to=schaefer@tiny.zanshin.com \
    --cc=nirva@ishiboo.com \
    --cc=schaefer@zanshin.com \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).