From 4263d2b8215024e4f93620b791b83c2c7f878f94 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 11 Mar 2011 21:05:59 +0000 Subject: 28889: ${##} should return the length of $# --- ChangeLog | 7 ++++++- Src/subst.c | 1 + Test/D04parameter.ztst | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 237578f2d..244b58e54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-03-11 Peter Stephenson + + * 28889: Src/subst.c, Test/D04parameter.ztst: ${##} should + return the length of $#. + 2011-03-11 Peter Stephenson * unposted: Completion/Zsh/Context/_dynamic_directory_name: @@ -14327,5 +14332,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5220 $ +* $Revision: 1.5221 $ ***************************************************** diff --git a/Src/subst.c b/Src/subst.c index 9b3699a47..dfe96c890 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2039,6 +2039,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) } else if ((c == '#' || c == Pound) && (itype_end(s+1, IIDENT, 0) != s + 1 || (cc = s[1]) == '*' || cc == Star || cc == '@' + || cc == '#' || cc == Pound || cc == '-' || (cc == ':' && s[2] == '-') || (isstring(cc) && (s[2] == Inbrace || s[2] == Inpar)))) { getlen = 1 + whichlen, s++; diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index c0ad1d29a..36462456b 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -175,6 +175,14 @@ 0:${#...}, $#... >8 8 8 8 8 8 8 8 + set 1 2 3 4 5 6 7 8 9 + print ${##} + set 1 2 3 4 5 6 7 8 9 10 + print ${##} +0:${##} is length of $# +>1 +>2 + array=(once bitten twice shy) print IF${array}THEN print IF${^array}THEN -- cgit 1.4.1