bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maximum length of variable name


From: Robert Elz
Subject: Re: Maximum length of variable name
Date: Fri, 16 Nov 2018 08:49:39 +0700

    Date:        Thu, 15 Nov 2018 12:09:46 -0600
    From:        Eric Blake <address@hidden>
    Message-ID:  <address@hidden>

  | 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]