From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9072 invoked by alias); 10 May 2016 10:34:34 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21534 Received: (qmail 8457 invoked from network); 10 May 2016 10:34:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Date: Tue, 10 May 2016 12:26:00 +0200 From: Roman Neuhauser To: Sebastian Gniazdowski Cc: Zsh Users Subject: Re: Rotate words in string Message-ID: <20160510102600.GB3514@isis.sigpipe.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) # sgniazdowski@gmail.com / 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