From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: Evaluation of $# - bug?
Date: Mon, 04 Dec 2000 11:57:04 +0000 [thread overview]
Message-ID: <0G51000DAL739B@la-la.cambridgesiliconradio.com> (raw)
In-Reply-To: "Your message of Mon, 04 Dec 2000 12:33:49 +0100." <200012041133.MAA05780@beta.informatik.hu-berlin.de>
> Always remember that there is a parameter named `-' (the option
> string), so `$#-' gives the length of the value of that parameter and
> `$#-1' gives that with a `1' stuck to the end.
>
> Use `${#}-1'.
This probably deserves a special note. Unless anybody really objects to
clarity in the documentation.
Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.5
diff -u -r1.5 params.yo
--- Doc/Zsh/params.yo 2000/08/29 06:35:40 1.5
+++ Doc/Zsh/params.yo 2000/12/04 11:55:35
@@ -240,7 +240,11 @@
)
vindex(#)
item(tt(#) <S>)(
-The number of positional parameters in decimal.
+The number of positional parameters in decimal. Note that some confusion
+may occur with the syntax tt($#)var(param) which substitutes the length of
+var(param). Use tt(${#}) to resolve ambiguities. In particular, the
+sequence `tt($#-)var(...)' in an arithmetic expression is interpreted as
+the length of the parameter tt(-), q.v.
)
vindex(ARGC)
item(tt(ARGC) <S> <Z>)(
--
Peter Stephenson <pws@csr.com> Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
next parent reply other threads:[~2000-12-04 11:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200012041133.MAA05780@beta.informatik.hu-berlin.de>
2000-12-04 11:57 ` Peter Stephenson [this message]
2000-12-04 16:04 ` Bart Schaefer
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=0G51000DAL739B@la-la.cambridgesiliconradio.com \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.auc.dk \
/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).