Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Matthew Persico Newsgroups: gnu.bash.bug Subject: Re: Dashes in function names: Undocumented? Date: Wed, 12 Aug 2020 11:51:58 -0400 Lines: 70 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1597247536 6786 209.51.188.17 (12 Aug 2020 15:52:16 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Eli Schwartz Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wicHv+3K8Y7U2cfIqWbHGsPk7Hu8L1SeAvgSUbl9dAA=; b=LftHkmMUc38kynTNmJOUh/izaldpLXXEnbhuSZDOa9GOuexpg4pjP4PTTb1Q/GdlF2 kPrCjIcD2hjMTNpwLs4BY6MFS/bdqZTJE4dVFTM/DbWhSDGJXDIDVv62/z+zkUCaKicG z75Qy33cHNTlQNvNM7IB2RnMduju32YkzQ7qzKdMpkl4a/Af0eHYljSiEtzhQ3V4B67v x3RbQNV1gxDpcld3z+gMp6Ip/D/1/s1gNwnJh2eWEJGsCBcQ+l+Hd2v9WINTz5Y8p5EH ENZExOQkD0DfyrdOYB83gNLHg6O1PYi4ZCgH8u1K2QfDbcK8NBg0EhsG/rTj6pCf4RyG r2ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wicHv+3K8Y7U2cfIqWbHGsPk7Hu8L1SeAvgSUbl9dAA=; b=mP+0AJ4+ebLQwSTDddi7j2gRWiwq+U6rl0H4BqbrjBuQ9qn9Mv9UGhBaEV7GnH038s 1JcB1e/+Rhihbmfa5sjWi2A6drgYt2B42rsyUyyClY8AT32NoY5kFJn/UQ04NhaHh3ds JzhD1dkl/6WyBqQozIxMg93hjGbY1f/CfKB7GwvCzip6M7rV9cPZOq3enO/KK5C0u1yl UdOXFWkidbTvBplNZxZEB6GdSe8VtyhhEwdoNWpN3KQsSSP9OTjGM8d9/ZhBeUuKNTm1 KzzZMoTeUsPuVeDERSJUsCdF8FG5kKcByXPrLBIQjNDIo+wS/YgJB6YyF1rPwgZET2eB idyg== X-Gm-Message-State: AOAM531IZq3cdscSL6KMVH0y+DwPx/8zXLLRZ8BU2JmuXY4exeVyaIIU HInnlaWj4gqs7utmFfhvlpL9QtbaVt00heLOxA8= X-Google-Smtp-Source: ABdhPJy5rpAiY8saHoxOKkI7R5Y3tAPnY6iadsYhg07jCNr41916mpnJOvahJl4xm6gl860dqph3OkePeHcDKMh/3rM= X-Received: by 2002:a67:fd5b:: with SMTP id g27mr692519vsr.230.1597247531683; Wed, 12 Aug 2020 08:52:11 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e32; envelope-from=matthew.persico@gmail.com; helo=mail-vs1-xe32.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16747 On Wed, Aug 12, 2020 at 11:06 AM Eli Schwartz wrote: > On 8/12/20 10:51 AM, Matthew Persico wrote: > > I put a bug report into an emacs group because the bash syntax > highlighter > > failed to recognize functions whose names have dashes in them. > > > > The maintainer came back with this: > > > > I can reproduce this behaviour, but is it really a bug? Aren't the > > names with '-' invalid? > > The Bash Reference Manual says: > > name > > A word consisting solely of letters, numbers, and underscores, and > > beginning with a letter or underscore. Names are used as shell > > variable and function names. Also referred to as an identifier. > > https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html > > > > I looked at the manual and I didn't see positive or negative > > acknowledgement that dashes can be used in function names. But it does > work. > > > > Update to manual? > > The bash-20191127 snapshot updated the manpage documentation for a > function definition (to align with reality). It is now defined as: > > function fname [()] compound-command [redirection] > > and includes the description: > > When in posix mode, fname must be a valid shell name and may not be the > name of one of the POSIX special builtins. In default mode, a function > name can be any unquoted shell word that does not contain $. > > For context: > > word - A sequence of characters considered as a single unit by the > shell. Also known as a token. > > name - A word consisting only of alphanumeric characters and > underscores, and beginning with an alphabetic character or an > underscore. Also referred to as an identifier. > > > > name > > A word consisting solely of letters, numbers, and underscores, and > > beginning with a letter or underscore. Names are used as shell > > variables. Also referred to as an identifier. > > > > function name > > A word consisting solely of letters, numbers, underscores, dashes, and > > beginning with a letter or underscore. Function names are used to label > > shell > > functions. > > > > > -- > Eli Schwartz > Bug Wrangler and Trusted User > > Thanks. I will take your word for it, as I cannot seem to find that text at https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html, unless that is not the canonical location for the manual. -- Matthew O. Persico