Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Rotate words in string
- X-seq: zsh-users 21534
- From: Roman Neuhauser <neuhauser@xxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Rotate words in string
- Date: Tue, 10 May 2016 12:26:00 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAKc7PVA+CTn2Zj=Eg9Zf7D63-jJRtrQe67oDXH6kLB4+5peTLg@mail.gmail.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: <CAKc7PVA+CTn2Zj=Eg9Zf7D63-jJRtrQe67oDXH6kLB4+5peTLg@mail.gmail.com>
# sgniazdowski@xxxxxxxxx / 2016-05-10 07:39:22 +0200:
> having space separated string of words, how to nicely rotate the words
> in it? So:
> word1 word2 word3
>
> becomes:
> word3 word1 word2
>
> and so on?
turn it into an array, then:
words=($words[-1] $words[1,-2])
--
roman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author