Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > gnu.bash.bug > #16751
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Dashes in function names: Undocumented? |
| Date | 2020-08-13 10:02 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.1956.1597327355.2739.bug-bash@gnu.org> (permalink) |
| References | <f53f8a84-ac66-6d61-7066-01c14e8f2ce4@archlinux.org> <CAL20dLDNniiOycTe-j6t0ynS+9FG32UgDGJbn+iDEMG7Ls_==Q@mail.gmail.com> <9722.1597303965@jinx.noi.kre.to> <c90d22e1-3c02-779f-98d0-8a382bff0d91@case.edu> |
On 8/13/20 3:32 AM, Robert Elz wrote: > Date: Wed, 12 Aug 2020 11:05:40 -0400 > From: Eli Schwartz <eschwartz@archlinux.org> > Message-ID: <f53f8a84-ac66-6d61-7066-01c14e8f2ce4@archlinux.org> > > > | 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 $. > > There's no need for the posix mode test here, in posix mode a function > with the same name as a special builtin won't be found (the special builtin > is located first) but it doesn't need to be an error to define it (posix > does not require that). It's an application restriction that bash chooses to enforce: "the application shall ensure that it is a name (see XBD Name) and that it is not the name of a special built-in utility." It's a non-fatal error; some shells, like dash and ksh93, make it a fatal syntax error to define a function with the same name as a special builtin. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Dashes in function names: Undocumented? Chet Ramey <chet.ramey@case.edu> - 2020-08-13 10:02 -0400
csiph-web