Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A bug or improperly formatted script
- X-seq: zsh-users 22501
- From: Jim <linux.tech.guy@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: A bug or improperly formatted script
- Date: Sat, 25 Feb 2017 18:58:31 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to; bh=tkkWH9VpSCpxrKKGZhgC0kfF/QPwdf4LQMwSS1yl5Fw=; b=sEKnbT5fq3ECm6zxUgDgdElrgSD/SfiuLWieuB4FR42DiqAP0OCePfXp9fb22egTDg FJNe3yATrNqik9rVWZNraif387/a/Ger44nE43FSvSvZX+yNs2iE6pnQ3eA7A4i6Wsfz QnwT7XAa9bch+LTN6A2wiaQSToRSchoJci0k/VF/iwSkkOukL17tllFmFZRhXb7DCtz+ xy39WwMkdtnFYPso5Q9bujCkmUb6ndHA4zhDUHg2L718w4QjEAc7bSCOAl/JQiKwjDRE y28MiItw8j1UZ/t1tCaGJi8EuYNszSk7YZr1TlmlY5fGpWCEfKE+pLXqdlD/zyVZtHoC aTwQ==
- In-reply-to: <170225154140.ZM19138@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CA+rB6GJoCDbdEVYR-zYEh6P0Oau7VAxQeW6UcnksdeB3hvL=HQ@mail.gmail.com> <170225141211.ZM20788@torch.brasslantern.com> <CA+rB6G+5s7QPuT-iRwZHOC3Mg7aSbk+4M7V6wgzTBGjTW_+4yw@mail.gmail.com> <170225154140.ZM19138@torch.brasslantern.com>
- Reply-to: linuxtechguy@xxxxxxxxx
On Sat, Feb 25, 2017 at 5:41 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Feb 25, 4:53pm, Jim wrote:
> }
> } So in my original email the alternate example
> }
> } print $((${(z)${(fO)"$(dirs -v)"}[1][1]} + 1))
> }
> } was this forcing it to an array or was it a fluke?
>
> It was a fluke. ${${$(print $'0\t~')[1]}[1]} == '0' whereas
> ${${$(print $'0\t~')[-1]}[1]} == '~' and $(( ~ + 1 )) == -2 (the
> tilde being interpreted as bitwise negation).
>
> Double-subscripting $var[1][1] yields the same byte whether $var is
> a scalar or an array, whereas $var[-1][1] does not unless the scalar
> is only a single character to begin with.
>
> You'd never have seen -2 if $HOME were not the only entry in the
> stack. With $(dirs -lv) or with most other directories, the last char
> of the directory name would have been intepreted as a variable name
> and potentially produced even stranger results (though most like it
> would be an unset variable and thus be treated as zero, hiding the
> effect entirely). A directory name ending in digits would have made
> things even stranger.
>
Still digesting, but I can say I learned my something new for today, so
the day wasn't wasted. Looking forward to the patch you submitted.
I had tried the (A) flag, just in case it might work, but it didn't.
Wondered myself why it shouldn't apply in the case.
Thanks for your help.
Jim
Messages sorted by:
Reverse Date,
Date,
Thread,
Author