zsh-workers
 help / color / mirror / code / Atom feed
From: Eric Blake <eblake@redhat.com>
To: zsh-workers@zsh.org
Subject: bug in ${##} expansion
Date: Fri, 11 Mar 2011 12:07:20 -0700	[thread overview]
Message-ID: <4D7A72E8.5070909@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

POSIX requires ${#parameter} to expand to the length of parameter as a
string.  It also requires that ${parameter#word} substitution have a
word (that is, ${parameter#} with a missing word is a zsh extension).

Therefore, this should output 2, not 11:

zsh -c 'set 1 2 3 4 5 6 7 8 9 10 11; echo ${##}'

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

             reply	other threads:[~2011-03-11 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 19:07 Eric Blake [this message]
2011-03-11 20:04 ` Peter Stephenson
2011-03-21 10:15   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D7A72E8.5070909@redhat.com \
    --to=eblake@redhat.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).