On 8/13/20 3:32 AM, Robert Elz wrote: > Date: Wed, 12 Aug 2020 11:05:40 -0400 > From: Eli Schwartz <eschwa...@archlinux.org> > Message-ID: <f53f8a84-ac66-6d61-7066-01c14e8f2...@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 c...@case.edu http://tiswww.cwru.edu/~chet/