Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16254
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Robert Elz <kre@munnari.OZ.AU> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: How functions are defined |
| Date | Tue, 28 Apr 2020 22:46:52 +0700 |
| Lines | 49 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1487.1588088935.3066.bug-bash@gnu.org> (permalink) |
| References | <87pnbsfjss.fsf@hobgoblin.ariadne.com> <28227.1588088812@jinx.noi.kre.to> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1588088935 27821 209.51.188.17 (28 Apr 2020 15:48:55 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | worley@alum.mit.edu (Dale R. Worley) |
| Envelope-to | bug-bash@gnu.org |
| In-Reply-To | <87pnbsfjss.fsf@hobgoblin.ariadne.com> |
| Received-SPF | permerror client-ip=2001:3c8:9009:181::2; envelope-from=kre@munnari.OZ.AU; helo=munnari.OZ.AU |
| X-detected-operating-system | by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 |
| X-Received-From | 2001:3c8:9009:181::2 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <28227.1588088812@jinx.noi.kre.to> |
| X-Mailman-Original-References | <87pnbsfjss.fsf@hobgoblin.ariadne.com> |
| Xref | csiph.com gnu.bash.bug:16254 |
Show key headers only | View raw
Date: Mon, 27 Apr 2020 22:03:47 -0400
From: worley@alum.mit.edu (Dale R. Worley)
Message-ID: <87pnbsfjss.fsf@hobgoblin.ariadne.com>
| While I was looking at the details of parsing function definitions, I
| tripped on something I should have noticed long ago. In the function
| definition
|
| function foo() {
| command
| }
I think this is your problem. The definition of a function is
really
name ( ) compound-command
and in the ksh/bash variant version
function name ( ) compound-command
There are no braces in the syntax (and I omitted redirections which are
not relevant here).
When looking for a "compound-command" we start out looking for the
first word of a command, and that's exactly where a reserved word
can be found.
Some shells actually permit
name ( ) command
instead where it is even clearer (but which gives rise to one small,
and mostly irrelevant, ambiguity - also not relevant here.)
Note that the text you quoted:
Reserved words are words that have a special meaning to the shell. The
following words are recognized as reserved when unquoted and either the
first word of a simple command ...
note that "first word" has nothing to do with lines, that the "name ()"
comes earlier doesn't mean that a command (or compound-command) doesn't
follow, and that thing starts with a "first word" (of itself).
kre
Back to gnu.bash.bug | Previous | Next | Find similar
Re: How functions are defined Robert Elz <kre@munnari.OZ.AU> - 2020-04-28 22:46 +0700
csiph-web