From: Eric Blake <eblake@redhat.com>
To: Harald van Dijk <harald@gigawatt.nl>
Cc: dash@vger.kernel.org, Jilles Tjoelker <jilles@stack.nl>
Subject: Re: [PATCH] Improved LINENO support
Date: Fri, 12 Nov 2010 11:35:52 -0700 [thread overview]
Message-ID: <4CDD8908.9010206@redhat.com> (raw)
In-Reply-To: <4CDD8481.1060306@gigawatt.nl>
[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]
On 11/12/2010 11:17 AM, Harald van Dijk wrote:
> (
> :
> :
> :
> :
> :
> ) >test-$LINENO
>
> should write to file test-1, not test-7, even though the only word is on
> line 7. bash gets this wrong, pdksh gets this almost right.
Umm - there was more than one word in that example (each : in the
subshell is a word). But I agree that the subshell command itself
started on line 1, but the word containing $LINENO is on line 7.
There are _so many_ variations on what this example would do that it's
hard to say that any one version is definitively correct. In general,
the standard tends to favor the ksh93 interpretation of things; but on
your example, it touches the file test-6 (not test-7 nor test-1).
All I can see in the standard is:
"Set by the shell to a decimal number representing the current
sequential line number (numbered starting with 1) within a script or
function before it executes each command."
with no hint as to whether LINENO auto-increments over the number of
newlines encountered while parsing that command.
--
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 --]
next prev parent reply other threads:[~2010-11-12 18:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 20:33 [PATCH] Improved LINENO support Harald van Dijk
2010-11-10 22:00 ` Jilles Tjoelker
2010-11-11 20:33 ` Harald van Dijk
2010-11-12 18:17 ` Harald van Dijk
2010-11-12 18:35 ` Eric Blake [this message]
2010-11-12 19:08 ` Harald van Dijk
2010-11-12 19:40 ` Harald van Dijk
2010-11-12 21:29 ` Jilles Tjoelker
2010-11-27 16:56 ` Harald van Dijk
2011-03-10 8:10 ` Herbert Xu
2011-03-11 21:56 ` Harald van Dijk
2011-03-15 7:52 ` Herbert Xu
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=4CDD8908.9010206@redhat.com \
--to=eblake@redhat.com \
--cc=dash@vger.kernel.org \
--cc=harald@gigawatt.nl \
--cc=jilles@stack.nl \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.