From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16836 invoked from network); 1 Oct 2003 15:15:03 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 1 Oct 2003 15:15:03 -0000 Received: (qmail 24381 invoked by alias); 1 Oct 2003 15:14:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19160 Received: (qmail 24370 invoked from network); 1 Oct 2003 15:14:55 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 1 Oct 2003 15:14:55 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.3.58.249] by sunsite.dk (MessageWall 1.0.8) with SMTP; 1 Oct 2003 15:14:55 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h91FErJ21075 for zsh-workers@sunsite.dk; Wed, 1 Oct 2003 08:14:53 -0700 From: Bart Schaefer Message-Id: <1031001151452.ZM21074@candle.brasslantern.com> Date: Wed, 1 Oct 2003 15:14:52 +0000 In-Reply-To: <20031001092757.GA31207@DervishD> Comments: In reply to DervishD "Stripping spaces from a shell variable, portably" (Oct 1, 11:27am) References: <20031001092757.GA31207@DervishD> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh Subject: Re: Stripping spaces from a shell variable, portably MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 1, 11:27am, DervishD wrote: } } I need to strip leading and trailing spaces from the contents of } a shell variable, and I need to do it [...] using SuSv3 } constructs, not Zsh extensions. What about: tmp="${variable##*[^ ]}" variable="${variable%${tmp}}" tmp="${variable%%[^ ]*}" variable="${variable#${tmp}}"