Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: DWIM interface to date args; reverse array
- X-seq: zsh-users 22982
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: DWIM interface to date args; reverse array
- Date: Wed, 15 Nov 2017 14:57:31 +0000
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171115145737euoutp024fdddf0a0ca58940e159c256f0d0b5d1~3SkRf0bGy2045820458euoutp02K
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1510757857; bh=cMbT1hjIozOrk0t+jYATW40O+Ey0V6epuwTn57uQ7OA=; h=Date:From:To:Subject:In-reply-to:References:From; b=byGy6y/c99/FJ+0BeYrJqiAmrS3/ViBOVqvv3ia7cEUx4FuTB/uHyy+WsP21C+Q5a 91oxbtEPcj4FysiSElhvZ4kjZ5/uNcdeKlwHuHjxy1dYO4DEwNFr9Iiv07WawaKd1k i/6G1BKV031dW8oSlhkdH77JnzK3vP17Tv6DoN4w=
- In-reply-to: <86375f1ubr.fsf@zoho.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>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CGME20171115143925epcas2p39a7bfefe245b1b93d1d19dcf210770f3@epcas2p3.samsung.com> <86375f1ubr.fsf@zoho.com>
On Wed, 15 Nov 2017 15:37:44 +0100
Emanuel Berg <moasen@xxxxxxxx> wrote:
> time-from () {
I'd suggest if the question is really "how do I reverse an array?", it's
best not to add distracting material which is simply hiding your
question. The more obvious the question is, the more people will bother
thinking about it.
On the other hand, if you were asking "how do I write this function
better?" then the context would certainly be important. But I don't
see that question here.
> # instead of doing this one could reverse the original data array
> # I Googled "zsh reverse array" and found ${(Oa)array}
> # but seems to only work when I echo it,
> # not assign it to another array
You haven't shown what you expected to work that didn't, so I can't
really answer what you actually said, so I'm reduced to guesswork.
Please show (just) what you think should work and doesn't. (Or, to
put it another way, the answer to what you just said is "yes, it does
actually work", which I'm guessing isn't going to help you much...)
Try
array=(${(Oa)array})
remembering the outer parenthesis, otherwise you are assigning a scalar.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author