I’m reading "Bash Guide for Beginners". It says:
If the first character of
PARAMETERis an exclamation point, Bash uses the value of the variable formed from the rest ofPARAMETERas the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value ofPARAMETERitself. This is known as indirect expansion.
The example given is:
franky ~> echo ${!N*} NNTPPORT NNTPSERVER NPX_PLUGIN_PATH
I don’t quite understand here:
the value of the variable formed from the rest of
PARAMETER
As the PARAMETER is just !N*, then
the rest of
PARAMETER
is just N*. How could this form a variable? Did Bash search all possible commands there?
If you read the
bashman page, it basically confirms what you have stated:However, reading on from there:
In other words, your particular example
${!N*}is an exception to the rule you quoted. It does, however, work as advertised in the expected cases, such as: