zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: dado <dado@pdi.com>, <zsh-users@sunsite.auc.dk>
Subject: Re: strange glob expansion
Date: Fri, 3 Sep 1999 04:54:10 +0000	[thread overview]
Message-ID: <990903045410.ZM25110@candle.brasslantern.com> (raw)
In-Reply-To: <37CF36E2.E0627CAC@pdi.com>

On Sep 2,  7:48pm, dado wrote:
} Subject: Re: strange glob expansion
}
} > That's what `setopt cshnullglob` is for.  I can't imagine why anyone would
} > not want that option when the shell is interactive; brace expansion is
} > practically useless without it.
} 
} It's true. It always annoyed me that a no match would brake the whole thing.
} But I just tried setopt cshnullglob to no avail.
} It's still complaining about a no match, even if there are other matches:
} 
} dado@saci:~/pdi/timesheet 16 -> setopt | grep null
} cshnullglob
} 
} dado@saci:~/pdi/timesheet 17 -> ll 99090{0,1,2,3}
} UX:ls: ERROR: Cannot access 990900: No such file or directory
} UX:ls: ERROR: Cannot access 990903: No such file or directory

No, look:  It's not zsh claiming "no match", it's "ls" saying there is no
such file.  Besides, there are no glob patterns in that example, so you
would not get "no match" even if you unsetopt cshnullglob.

This is a subtle but important point:  Brace expansion is not globbing.
Brace expansion happens before globbing; "ll 99090{0,1,2,3}" is exactly
the same as typing out "ll 990900 990901 990902 990903".

In other words, the result of brace expansion is not tested against the
filesystem _unless_ there is also a * ? [] or parenthesized pattern in
that result.  (Or a number range, see below.)

However, if instead you used 99090{0,1,2,3}*, that would expand to
990900* 990901* 990902* 990903*, which zsh would test against the file
names and therefore throw out 990900* 990903* as not matching.  If you
did not use nullglob or cshnullglob, zsh would complain "no match."

} I also would like to have the same behavior on 99090{0..3}
} Is that possible?

In this case, you probably want number ranges:

	ll 99090<0-3>
Or
	ll <990900-990903>

The form lessthan digits hyphen digits greaterthan is a glob pattern, too
(I should have mentioned that in my last message to Adam).  <123-> means
"all numbers greater than 123," <-789> means "all numbers less than 789,"
and <-> means "any number."  This is a bit surprising as it looks like a
redirection, but eventually one runs out of nonalphanumeric characters to
use as delimiters.  Parens were already far too overloaded.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-09-03  4:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-01  8:11 Hubert Canon
1999-09-01 17:46 ` Bart Schaefer
1999-09-02 10:15   ` Hubert Canon
1999-09-02 15:01     ` Bart Schaefer
1999-09-03  2:48       ` dado
1999-09-03  4:54         ` Bart Schaefer [this message]
1999-09-03 12:11       ` Hubert Canon
1999-09-03 14:15         ` Bart Schaefer
1999-09-03 14:34           ` Hubert Canon
1999-09-03  1:40   ` Adam Spiers
1999-09-03  4:34     ` Bart Schaefer
1999-09-03  8:55       ` Peter Stephenson
1999-09-05 21:07         ` Adam Spiers

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=990903045410.ZM25110@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=dado@pdi.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).