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

Re: A way to untie -T vars?



On Sat, Jan 21, 2023 at 5:56 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Jan 21, 2023 at 8:38 AM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > 'm using -U flag to quickly uniquify the scalar, however this method is problematic as the array vars are left over.
>
> I don't follow what this is intended to accomplish?

While trying to understand what Sebastian meant I've accidentally
discovered an unorthodox way to unset a parameter.

    unset2() {
      local _"$1"
      typeset -gT _"$1" "$1"
    }

Test:

    % foo=hello
    % unset2 foo
    % typeset -p foo
    typeset: no such variable: foo

I sort of understand why that happens but it doesn't look intended.

Roman.




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