Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Rotate words in string



# 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