[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] make function local
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] make function local |
Date: |
Fri, 17 Apr 2015 08:17:17 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Apr 16, 2015 at 10:38:22PM -0700, Linda Walsh wrote:
> It's a trite example, but I do something like:
>
>
> sub gvim () {
> array orig_args=($@) gv_files=() gv_ops=()
> int use_tab=0 look_for_ops=1
>
> sub _exec_gvim() {
> array args
> ((use_tab)) && args=("-p")
> (( ${#gv_ops[@]:-0} )) && args+=(${gv_ops[@]})
> (( $# )) && args+=($@)
> command gvim "${args[@]}"
> unset -f _exec_gvim
> }
> ....
>
>
> 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
- Re: [Help-bash] make function local, (continued)
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/13
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/16
- Bash performance when declaring variables (was: Re: [Help-bash] make function local), Eduardo A . Bustamante López, 2015/04/16
- Re: Bash performance when declaring variables, Chet Ramey, 2015/04/17
- Re: Bash performance when declaring variables, Eduardo A . Bustamante López, 2015/04/17
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/16
- Re: [Help-bash] make function local, Dan Douglas, 2015/04/16
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/16
- Re: [Help-bash] make function local, Dan Douglas, 2015/04/10
Re: [Help-bash] make function local, Linda Walsh, 2015/04/17
Re: [Help-bash] make function local, Eduardo A . Bustamante López, 2015/04/17
Re: [Help-bash] make function local, Linda Walsh, 2015/04/17
Re: [Help-bash] make function local, Greg Wooledge, 2015/04/17
Re: [Help-bash] make function local, Linda Walsh, 2015/04/17
Re: [Help-bash] make function local, Eduardo A . Bustamante López, 2015/04/17
Re: [Help-bash] make function local, Linda Walsh, 2015/04/17
Re: [Help-bash] make function local, Eduardo A . Bustamante López, 2015/04/17
Re: [Help-bash] make function local, Chet Ramey, 2015/04/19
Re: [Help-bash] make function local, Peng Yu, 2015/04/19