Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
bar='#pat'; ${foo/$bar/...} problem
- X-seq: zsh-workers 6000
- From: "Andrej Borsenkow" <borsenkow.msk@xxxxxx>
- To: "ZSH workers mailing list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: bar='#pat'; ${foo/$bar/...} problem
- Date: Thu, 1 Apr 1999 18:04:41 +0400
- Importance: Normal
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author