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

Re: ${...%%=*} problem



On Jun 7, 11:29am, Andrej Borsenkow wrote:
} Subject: RE: ${...%%=*} problem
}
} > > bor@itsrm2% print ${foo%%=*}
} > > zsh: * not found
} > >
} > > Why?
} >
} > Because it does expansion, include the one after an equal sign:
} 
} This violates our own documentation:

You're sort of correct, but you quoted the wrong section of the doc.
The relevant bit is this, under parameter expansion:

 In the expansions discussed below that require a pattern, the form of
 the pattern is the same as that used for filename generation; see *Note
 Filename Generation::.  Note that these patterns, along with the
 replacement text of any substitutions, are themselves subject to
 parameter expansion, command substitution, and arithmetic expansion.

That paragraph should include "filename expansion" (but not generation)
among the list of things to which the patterns are subject.  So

	${foo##~}

removes the home directory from $foo.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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