Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: local unfunction
- X-seq: zsh-users 23291
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: local unfunction
- Date: Fri, 30 Mar 2018 22:10:59 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NNmco8lTSzhRseqSCfsiMVLSOXjA74pL+srKWLZ8zEA=; b=EuixVlXaxWYHOQBw7lCi85Z9/XXR6lYCtII0pT9m50tykTXVBcXQWvOU+LPCqu0QSq VPm6EVl+jEmnm2cm+0Rm8WBhcxIGlJpQgAQy/O4qMHNj4VRQ2hJFmf+lXhhxu0xH39oj 9VBiYTlR+ZxpWR4lPqukGfRFaxV812aXh++7XODifAAd4bbBIX+/hK+RdFlnShTDFcin DQo7uNjE896noBzh33LhVB3TMjZNfwdGnW/PZjBgbGOEih7RseREPziDeuwLxurW1TkX gbu0aJJYPpAarG3EL07RRMXqmFO+mdEYhjyv6GKycHcSEa/RBy90EkIy8zwUEuki5e2Q lkHw==
- In-reply-to: <9e0faf6b-b19e-b6d6-0eb7-6ea20b2c2154@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <9e0faf6b-b19e-b6d6-0eb7-6ea20b2c2154@eastlink.ca>
On Fri, Mar 30, 2018 at 6:11 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Is it possible to unfunction something just within another function? I've
> tried:
>
> unset -fm ....
>
> ... but the functions remain dead after the calling function returns. I can
> of course just resource them, but I'll bet the unset can be made local.
If it's okay to also cancel all other side effects, you can use a subshell,
function() hey {
normal stuff here
(
unfunction foo
foo
a=5 # this will also disappear after the )
)
}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author