Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14826

Re: Maximum length of variable name

From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: Maximum length of variable name
Date 2018-11-16 08:49 +0700
Message-ID <mailman.4117.1542333013.1284.bug-bash@gnu.org> (permalink)
References <8491692f-8d4a-f24f-2744-2de3465a9cfd@redhat.com> <7f63f0fe-61e2-4b39-bd00-3910dba190a8@googlegroups.com>

Show all headers | View raw


    Date:        Thu, 15 Nov 2018 12:09:46 -0600
    From:        Eric Blake <eblake@redhat.com>
    Message-ID:  <8491692f-8d4a-f24f-2744-2de3465a9cfd@redhat.com>

  | On 11/15/18 12:00 PM, RAL wrote:
  | > How is defined the maximum number of characters a variable name can have?
  |
  | Bash has no hardcoded limit, thus your maximum is dependent on how much 
  | free memory your system has.

I maintain the NetBSD sh (an ash derivative) - as part of that I have
a test that (amongst other things) tests long var names - it tests up to
about 1000 chars (including adding one extra char (or deleting the
last) and verifying that different vars result) - I have run that test
against bash with no problems at all.

I can't see any reason that much longer names would not work - given
that you understand that anything using them is not likely to run all
that fast (and will consume more memory than you'd expect probably).

kre

Back to gnu.bash.bug | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Maximum length of variable name RAL <rodrigoalveslima@gmail.com> - 2018-11-15 10:00 -0800
  Re: Maximum length of variable name Eric Blake <eblake@redhat.com> - 2018-11-15 12:09 -0600
  Re: Maximum length of variable name Robert Elz <kre@munnari.OZ.AU> - 2018-11-16 08:49 +0700

csiph-web