Re: Document variable names need to be all ASCII
On 4/19/21 8:28 AM, 積丹尼 Dan Jacobson wrote: $ e哈=1 bash: e哈=1: command not found OK, but on man bash is it ever mentioned that a variable name must be all ASCII? name A word consisting only of alphanumeric characters and under- scores, and beginning with an alphabetic character or an under- score. Also referred to as an identifier. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Re: Document variable names need to be all ASCII
On Mon, Apr 19, 2021 at 08:28:54PM +0800, 積丹尼 Dan Jacobson wrote: > $ e哈=1 > bash: e哈=1: command not found > OK, but on man bash is it ever mentioned that a variable name must be all > ASCII? > > ENVIRONMENT >When a program is invoked it is given an array of strings called the >environment. This is a list of name-value pairs, of the form >name=value > > PARAMETERS >A parameter is an entity that stores values. It can be a name, a num‐ >ber, or one of the special characters listed below under Special Param‐ >eters. A variable is a parameter denoted by a name. A variable has > ... DEFINITIONS name A word consisting only of alphanumeric characters and under‐ scores, and beginning with an alphabetic character or an under‐ score. Also referred to as an identifier. "Alphanumeric" here clearly means [[:alnum:]] within the POSIX locale.
Re: Document variable names need to be all ASCII
What a 'name' is, is further defined under "Definitions": "name: A word consisting solely of letters, numbers, and underscores, ..." But it seems you're right that it doesn't say the locale's idea of letters isn't taken into account. Some other shells do accept those. On Mon, Apr 19, 2021 at 4:28 PM 積丹尼 Dan Jacobson wrote: > $ e哈=1 > bash: e哈=1: command not found > OK, but on man bash is it ever mentioned that a variable name must be all > ASCII? > > ENVIRONMENT >When a program is invoked it is given an array of strings called > the >environment. This is a list of name-value pairs, of the > form >name=value > > PARAMETERS >A parameter is an entity that stores values. It can be a name, a > num‐ >ber, or one of the special characters listed below under Special > Param‐ >eters. A variable is a parameter denoted by a name. A variable > has ... > >
Document variable names need to be all ASCII
$ e哈=1 bash: e哈=1: command not found OK, but on man bash is it ever mentioned that a variable name must be all ASCII? ENVIRONMENT When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value PARAMETERS A parameter is an entity that stores values. It can be a name, a num‐ ber, or one of the special characters listed below under Special Param‐ eters. A variable is a parameter denoted by a name. A variable has ...