Whenever I want to find out something like this, I like to ask the computer. Here's a Korn shell script that will try creating variables with ever increasing length for the variable name. It will abort and report as soon as it doesn't create it.
[tt]
#!/bin/ksh
typeset -i COUNT=0
unset NAME
while (( COUNT += 1 ))
do
print "Trying name length: ${COUNT}"
# Create a name for the variable, one char longer each loop
export NAME=${NAME}Z
# Create the variable using that growing name
export ${NAME}=Test
# Uncomment these to see what the values are...
# print "Variable name is: ${NAME}"
# eval print "Value assigned to the big named variable: \$$NAME"
# eval print "Length of value assigned: \${#${NAME}}"
# Test if variable was created and abort if not
eval : \${${NAME}:?Failed on NAME length = ${COUNT}}
# Reset for next loop
unset ${NAME}
done
[/tt]
Basically the variable name is "Z", then "ZZ", then "ZZZ", and so forth. The value set to it is "Test" each time. As soon as the variable doesn't get created, it aborts and tells what length it died on.
I tested this on a Sun Ultra 2 running Solaris 8. It ran to well over 7,500 before I killed it. I don't know what the limit is, but it seemed to have no problem up to this point.
Hope this helps.