|
| From: | Linda Walsh |
| Subject: | Re: [Help-bash] make function local |
| Date: | Fri, 17 Apr 2015 11:51:00 -0700 |
| User-agent: | Thunderbird |
Greg Wooledge wrote:
AFAIK, _exec_gvim, can only be called from within "function gvim", no?That is not correct. In bash, all function definitions are global. imadev:~$ f1() { f2() { echo "I'm f2"; }; }; f1; f2 I'm f2
----
You left out a few important parts, like f2 being called inside f1 before
it returns, and unsetting f2:
f1() { f2() { echo "I'm f2 $1"; unset -f f2; }; f2 internal; }; f1; f2 external
I'm f2 internal
-bash: f2: command not found
Hmmm...
Seems to work for me.
| [Prev in Thread] | Current Thread | [Next in Thread] |