On 9/30/20 12:28 AM, Jason Miller wrote: > Gentoo linux, GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu) > > On the above vesion of bash, the following script will not run the echo > command > and print an error. On bash 4.4 it appears to treat the ${!foo} the same as > expanding an unset variable and thus outputs "bar": > > unset foo > echo ${!foo} bar
This is the result of https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00123.html I explained the reasoning in https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00165.html The basic idea is that indirect expansion is just a string substitution, so indirecting an unset variable is the logically same thing as ${}, which is an expansion error. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/