Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Should (t)path = array-unique-special work this way
- X-seq: zsh-workers 37969
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Should (t)path = array-unique-special work this way
- Date: Sun, 14 Feb 2016 14:34:43 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- In-reply-to: <CAKc7PVBrDBe-QQ5=3uC_G_eQSmg1MvSaG8QBdQN3Zn_htHkZmw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCDHQDc=sby5wGNEtWCA6omFhmP8uPWbsPXwTQv9tDqFw@mail.gmail.com> <160205091543.ZM29723@torch.brasslantern.com> <CAKc7PVBrDBe-QQ5=3uC_G_eQSmg1MvSaG8QBdQN3Zn_htHkZmw@mail.gmail.com>
Sebastian Gniazdowski wrote on Sun, Feb 14, 2016 at 11:04:02 +0100:
> On 5 February 2016 at 18:15, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > Q: Why doesn't -U appear in the "declare -p" output?
> > A: Good question. It doesn't appear for non-special arrays either. It
> > may be intentional because -U isn't a POSIX-supported option, but I
> > suspect it's just an accidental omission.
>
> Wanted to write a snapshot feature, basically declare -p > snapshot;
> setopt typesetsilent; source ./snapshot, but the omission of -U is
> quite a blocker. Other interesting thing is that typeset -a a doesn't
> fully redefine a, uniqueness still holds if it was present.
If the parameter already exists, 'typeset' will modify it rather than
replace it. For example, 'typeset x=foo; readonly x; echo $x' prints
'foo' rather than an empty string.
You might need to call 'unset' before calling 'typeset'? I'm not sure
whether that has any edgecases to beware of.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author