shell function name length, question
Emmanuel Deloget
logout at free.fr
Sat Aug 14 13:37:47 UTC 2021
Hello,
On Sat, Aug 14, 2021 at 12:19 PM Roberto A. Foglietta
<roberto.foglietta at gmail.com> wrote:
>
> Hi all,
>
> how long could be a shell function name?
>
> In my last patch, I used 256 characters because: "On Linux: The maximum length for a file name is 255 bytes". So, I have extended the concept to a function name but it is not the same.
>
> Thank you,
According to the discussion in [1], both bash and NETBSD sh can be
used with identifiers that are longer than 1000 characters. Bash seems
to not have any limit on identifier names. The POSIX sh standard
itself does not define anything related to the length of any
identifier (be it a variable name or a function name).
(I would totally accept shorter identifiers ; mine rarely goes larger
than 30-40 bytes, and these are the longest ; yet it's not difficult
to image a processor that could create longer identifier names).
[1] https://lists.gnu.org/archive/html/bug-bash/2018-11/msg00069.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/
> --
> Roberto A. Foglietta
> +39.349.33.30.697
Best regards,
-- Emmanuel Deloget
More information about the busybox
mailing list