[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Verifying behavior of nameref feature
From: |
Chet Ramey |
Subject: |
Re: Verifying behavior of nameref feature |
Date: |
Sat, 20 Dec 2014 13:40:48 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 12/19/14 5:10 PM, Jonathan Hankins wrote:
> I wanted to verify that this behavior is intended, as I can't find it
> described in the manual.
>
> $ echo $BASH_VERSION
> 4.3.30(1)-release
> $ foo=bar
> $ echo $foo
> bar
> $ bar=123
> $ echo $bar
> 123
> $ typeset -n foo
> $ echo $foo
> 123
> $ echo ${!foo} # this is what I want to verify
> bar
>
> Is using ${!foo} intended to yield the name of the var that foo references,
> now that foo has been turned into a nameref? I wanted to use this
> functionality in a script, but wanted to make sure it was intentional
> before I rely on it.
Yes, it's intentional. I decided to break with backwards compatibility to
implement the same nameref behavior as ksh93.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/