Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Overriding "builtin"
- X-seq: zsh-users 27942
- From: Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Overriding "builtin"
- Date: Fri, 12 Aug 2022 09:24:05 +0700
- Archived-at: <https://zsh.org/users/27942>
- In-reply-to: <CAMP9c5k1C8GmB+LE56J+o7xv2HDwHRApCHqrx0=NK93yh=BEUQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5k1C8GmB+LE56J+o7xv2HDwHRApCHqrx0=NK93yh=BEUQ@mail.gmail.com>
On 2022-08-11 20:18:49-0500, Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> I recently learned that 'builtin' can be overridden with a function. Neat
> for some silly tricks!
>
> However, is there a way to save / restore 'builtin' such that it can be
> restored?
>
> All that I can think of is 'unfunction builtin', but 'unfunction' itself
> can be overridden with a function.
You can run original builtin with "builtin".
e.g.:
echo() { printf '++%s\n' "$@"; }
echo this will run function
builtin echo this will run builtin
--
Danh
Messages sorted by:
Reverse Date,
Date,
Thread,
Author