On 11/6/20 12:21 PM, Edouard Thiel wrote:

>>> By the way, I have seen that the nameref works more or less for functions:
>>> $ foo() { echo "hello" ;}
>>> $ declare -n bar=foo
>>> but the reference has to be dereferenced when calling:
>>> $ ${!bar}
>>> hello
>>>
>>> is it still the case in bash 5?
>> Sure, it seems harmless to allow it.
> I mean, I was surprised I couldn't simply run
> $ bar

What would be reasonable to expect that to do? There's no word expansion,
so no opportunity to perform any kind of nameref expansion.

You can either use namerefs as you did above, or have no nameref attribute
and use ${bar}.

Chet

-- 
``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/

Reply via email to