zsh-workers
 help / color / mirror / code / Atom feed
* bar='#pat'; ${foo/$bar/...} problem
@ 1999-04-01 14:04 Andrej Borsenkow
  1999-04-02 10:39 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-04-01 14:04 UTC (permalink / raw)
  To: ZSH workers mailing list

It seems to be impossible to specify `#' (and probably `%') as part of the
replaced pattern:

bor@itsrm2:/tools/src/zsh-3.1.5-pws-14%> zsh -f
itsrm2% foo=(xxya xxyb)
itsrm2% bar=('xx' 'zz')
itsrm2% print ${foo/$bar[1]/$bar[2]}
zzya zzyb
itsrm2% bar=('#xx' 'zz')
itsrm2% print ${foo/$bar[1]/$bar[2]}
xxya xxyb
itsrm2% print ${foo/$~bar[1]/$bar[2]}
xxya xxyb
itsrm2% setopt extendedglob
itsrm2% print ${foo/$bar[1]/$bar[2]}
xxya xxyb
itsrm2% print ${foo/$~bar[1]/$bar[2]}
zsh: bad pattern: #xx
itsrm2% bar=('\#xx' 'zz')
itsrm2% print ${foo/$~bar[1]/$bar[2]}
xxya xxyb
itsrm2% print ${foo/$bar[1]/$bar[2]}
xxya xxyb
itsrm2%

Only the frirst one yields the correct result. But I need exactly the
run-time pattern, that should match only at the beginning ...

cheers

/andrej


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-04-02 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-01 14:04 bar='#pat'; ${foo/$bar/...} problem Andrej Borsenkow
1999-04-02 10:39 ` Bart Schaefer
1999-04-02 11:13   ` PATCH: 3.1.5-pws-14: " Bart Schaefer
1999-04-02 11:33     ` PATCH: " Bart Schaefer

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).