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

Re: Null tilde expansions?



"Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx> writes:

> On Oct 7,  8:00am, Greg Badros wrote:
> } Subject: Re: Null tilde expansions?
> }
> } "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx> writes:
> } 
> } > On Oct 6, 11:16am, Greg Badros wrote:
> } > } Subject: Null tilde expansions?
> } > }
> } > } Is there any way to make ~notauser not cause an error (similar to the
> } > } null globbing option)?
> } > 
> } > unsetopt badpattern
> } 
> } This doesn't work for me with Zsh 3.1.4 (few if any patches) or Zsh 3.0.5:
> 
> In the words of Geoff Wing: I hate it when I stuff up a post.
> 
> unsetopt badpattern nomatch

Thanks.  There were also some problems with the removing of ~notauser
words that you suggested:

 > dirs=(${(M)dirs:#~)

Besides the obvious typo of a closing paren for a closing brace, there
are three problems:

1) I want the (R)est, not the match, right?

2) The ~ needs to be escaped, otherwise it'll get expanded.  So what
actually works for me in Zsh-3.1.4 and Zsh-3.0.x is:

3) The pattern after the # needs to match the whole word, so it needs a
trailing *.

echo ${(R)dirs:#\~*}   # words that do not start with ~

#or

echo ${(M)dirs:#/*}    # words that start with /


Thanks again for your pointers and suggestions.  (And thanks to Peter
Stephenson as well!)

Greg



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