bug-bash
[Top][All Lists]
Advanced

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

temp env allows variables that look like array subscripts


From: Grisha Levit
Subject: temp env allows variables that look like array subscripts
Date: Tue, 17 Jul 2018 16:51:21 -0400

Usually, an assignment preceding a command that would create a
variable with an invalid name is rejected and treated like a command
name:

$ 1=X :
bash: 1=X: command not found

But when the variable name looks (sort of) like an array subscript
assignment, it is accepted and an oddly named variable is created:

$ f() { declare -p ${!var*}; }; var[0]=X address@hidden f
declare -x var[0]="X"
declare -x address@hidden"Y"



reply via email to

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