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:41am, Greg Badros wrote:
> } Subject: Re: Null tilde expansions?
> }
> }  > 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.
> } 3) The pattern after the # needs to match the whole word, so it needs a
> } trailing *.
> 
> Bleah.  This is what I get for testing stuff on a machine where the only
> home directory is my own, so the expansion of the only valid username
> "accidentally" matches the expansion of ~.
> 
> Yes, you're right.  Or just ${dirs##~*}, in which the ~ is not expanded
> in the first place.

Why does the ~ not get expanded?  This doesn't work in 3.1.4 or 3.0.x
for me.  I need to escape the ~ with a backslash here, too.

Greg



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