Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Overriding "builtin"



Wouldn't the above also break for this?

    function unhash() { ... }

It would be nice if we could add a feature such that the "builtin" identifier cannot be overloaded.

Zach Riggle



On Fri, Aug 12, 2022 at 1:43 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
On Fri, Aug 12, 2022, at 3:57 AM, Stephane Chazelas wrote:
> On 2022-08-12 08:12, Daniel Shahaf wrote:
> [...]
>> «unset 'functions[unfunction]'», provided (zsh/parameter is available
>> and) someone hasn't created an unset() function as well.
> [...]
>
> Or the standard "unset -f builtin"
>
> Or functions=()
>
> (or exec zsh -f)
>
> Or
>
> builtin() {
>    echo my builtin wrapper
>    set -o localoptions -o posixbuiltins
>    command builtin "$@"
> }

Or ''unhash -f builtin''.

I (perhaps overzealously) interpreted the original question as
asking for a method that is impervious to interference from *any*
function (and maybe alias?) definition.  But if you've broken your
shell so hard that *none* of these suggestions works, then, as they
say in the IRC channel, you get to keep the pieces.

--
vq


Messages sorted by: Reverse Date, Date, Thread, Author