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

Re: Exclusion on filename expansion



Thank you, Peter and Bart.

  - Vin

On Sun, Dec 7, 2014 at 2:01 PM, Peter Stephenson <
p.w.stephenson@xxxxxxxxxxxx> wrote:

> Vin Shelton wrote:
> > Using a variable, I cannot get ~ exclusion to work:
> >
> > ls *~abc~def
> >   ==> ghi jkl
> > pat="abc~def"
> > ls -d *~$pat
> >   ==> abc  def  ghi  jkl
> >
> > I think that expansion of $pat is happening after globbing, so in this
> case
> > "*" expands to
> >
> > abc def ghi jkl
> >
> > without the application of the tilde exclusion.
> >
> > Is there something I can do about this?
>
> "setopt glob_subst", or probably better use $~pat which turns on
> glob_subst for that expansion.  The "~" may appear to be an obvious
> mnemonic, but actually it was originally introduced to do the more
> standard form of ~-expansion.  It now turns on that and glob expansion.
>
> pws
>


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