[Help-bash] Walkaround for the limitation of declare -n
From:
Peng Yu
Subject:
[Help-bash] Walkaround for the limitation of declare -n
Date:
Wed, 12 Dec 2018 22:56:45 -0600
Hi,
https://mywiki.wooledge.org/BashFAQ/048
"The problem with bash's name references"
$ foo() { declare -n v=$1; }
$ bar() { declare -n v=$1; foo v; }
$ bar v
bash: warning: v: circular name reference
Given the above limitation (without having to upgrade the
developmental version), is there a good walk-around to avoid naming
conflict? I still would like to use the same name in different
functions. But this limitation forces that I have to use different
names if I need to call one function from another using reference.
--
Regards,
Peng
[Prev in Thread]
Current Thread
[Next in Thread]
[Help-bash] Walkaround for the limitation of declare -n,
Peng Yu<=