[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: idea about negative indexed array keys
From: |
Eli Schwartz |
Subject: |
Re: idea about negative indexed array keys |
Date: |
Fri, 12 Mar 2021 17:11:19 -0500 |
On 3/12/21 4:58 PM, Alex fxmbsw7 Ratchev wrote:
> i saw, ${arr[-1]} == syntax error
>
> what about implenting it, -0 is the last -1 is the second last etc
>
> such negative values are already in ${..:<>:<>} implented, as a good small
> statement for the same style
How did you accomplish the task of getting a syntax error for this? I
managed it with:
$ declare arr=(foo bar baz "syntax error")
$ echo "${arr[-1]}"; echo "${arr[-2]}"
syntax error
baz
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
- idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: idea about negative indexed array keys,
Eli Schwartz <=
- Re: idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: idea about negative indexed array keys, Greg Wooledge, 2021/03/13
- Re: idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/13
- Re: idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/13
- Re: idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/14
- Re: idea about negative indexed array keys, Greg Wooledge, 2021/03/14
- Re: idea about negative indexed array keys, Alex fxmbsw7 Ratchev, 2021/03/14