Re: [Help-bash] How to unset a local variable to expose the correspondin
From:
Greg Wooledge
Subject:
Re: [Help-bash] How to unset a local variable to expose the corresponding global variable in the function?
Date:
Mon, 8 Aug 2016 08:25:29 -0400
User-agent:
Mutt/1.4.2.3i
On Sat, Aug 06, 2016 at 09:05:12PM -0500, Peng Yu wrote:
> Hi, The following example shows that once the variable tmp is set
> local in a function my_fun, the function can not access the
> corresponding global variable. Is there a way to still get the global
> variable as if the local variable has not been set at all?
No. Stop shadowing globals that you want to access with locals of the
same name.