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


Groups > gnu.bash.bug > #14824 > unrolled thread

Maximum length of variable name

Started byRAL <rodrigoalveslima@gmail.com>
First post2018-11-15 10:00 -0800
Last post2018-11-16 08:49 +0700
Articles 3 — 3 participants

Back to article view | Back to gnu.bash.bug


Contents

  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

#14824 — Maximum length of variable name

FromRAL <rodrigoalveslima@gmail.com>
Date2018-11-15 10:00 -0800
SubjectMaximum length of variable name
Message-ID<7f63f0fe-61e2-4b39-bd00-3910dba190a8@googlegroups.com>
Hi,

How is defined the maximum number of characters a variable name can have?

[toc] | [next] | [standalone]


#14825

FromEric Blake <eblake@redhat.com>
Date2018-11-15 12:09 -0600
Message-ID<mailman.4099.1542305395.1284.bug-bash@gnu.org>
In reply to#14824
On 11/15/18 12:00 PM, RAL wrote:
> Hi,
> 
> 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.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

[toc] | [prev] | [next] | [standalone]


#14826

FromRobert Elz <kre@munnari.OZ.AU>
Date2018-11-16 08:49 +0700
Message-ID<mailman.4117.1542333013.1284.bug-bash@gnu.org>
In reply to#14824
    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

[toc] | [prev] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web