zsh-workers
 help / color / mirror / code / Atom feed
* bug in parameter expansion
@ 2012-11-07 19:13 Scott Moser
  2012-11-07 20:45 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Moser @ 2012-11-07 19:13 UTC (permalink / raw)
  To: zsh-workers

This issue was initially reported against shell code delivered in
cloud-init at [1], but it seems to me to be a bug in zsh's posix shell
behavior.

$ for shell in /bin/dash /bin/bash /bin/ksh /bin/zsh; do \
  echo "=== $shell ==="; $shell -c 'echo "${1%%=*}"' \
  -- A=B; done
=== /bin/dash ===
A
=== /bin/bash ===
A
=== /bin/ksh ===
A
=== /bin/zsh ===
zsh:1: * not found

It also has the issue when matching prefix (#):
$ zsh -c 'echo ${1#=?}' -- =AB
zsh:1: ? not found
$ bash -c 'echo ${1#=?}' -- =AB
B

It is seemingly easily worked around by escaping the '=' like:
  $ zsh -c 'echo "${1%%\=*}"' -- A=B
  A
or:
  zsh -c 'equal="="; echo "${1%%${equal}*}"' -- A=B
  A

Scott
--
[1] https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1073077


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

end of thread, other threads:[~2012-11-08 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 19:13 bug in parameter expansion Scott Moser
2012-11-07 20:45 ` Peter Stephenson
2012-11-08 14:53   ` Bart Schaefer
2012-11-08 15:20     ` Peter Stephenson

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