From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15244 invoked from network); 12 May 2005 09:39:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 May 2005 09:39:30 -0000 Received: (qmail 17900 invoked from network); 12 May 2005 09:39:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 May 2005 09:39:22 -0000 Received: (qmail 20708 invoked by alias); 12 May 2005 09:39:15 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8810 Received: (qmail 20694 invoked from network); 12 May 2005 09:39:14 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 May 2005 09:39:14 -0000 Received: (qmail 16868 invoked from network); 12 May 2005 09:39:14 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 12 May 2005 09:39:10 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Thu, 12 May 2005 10:37:23 +0100 Received: from csr.com ([10.102.144.127]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 12 May 2005 10:40:18 +0100 To: zsh-users@sunsite.dk Subject: Re: Little problem while converting from bash (quoting/splitting?) In-Reply-To: Message from "krasnal" of "Thu, 12 May 2005 09:28:17 +0300." <20050512060921.M13778@2-0.pl> References: <20050512060921.M13778@2-0.pl> Date: Thu, 12 May 2005 10:39:08 +0100 Message-ID: <12911.1115890748@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 12 May 2005 09:40:18.0493 (UTC) FILETIME=[9BB026D0:01C556D6] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 "krasnal" wrote: > This is with 4.2.4 cygwin version of zsh and 2.05b.0(1)-release of bash. > cleartool is windows program producing \r\n line terminated output. Note > that zsh has both \r and \n in f variable while bash has only \n. This is > a bit problematic for me because I'm eventually using these values for output > and the \r chars screw it up. Well, you could add \r to IFS, but unfortunately that will generate extra blank lines, for example: % (IFS=$' \t\n\000\r'; for f in $(print "foo\r"); do print $f | xxd; done) 0000000: 666f 6f0a foo. 0000000: 0a . Because you're selecting using a "case", it's possible these don't affect you, however. zsh makes it relatively straightforward to remove the trailing \r by surrounding the command substitution with a parameter-style expansion: % for f in ${$(print "foo\r")%%$'\r'}; do print $f | xxd; done 0000000: 666f 6f0a foo. (That only works if \r is *not* in IFS.) There's no mechanism for automatically turning \r\n into \n, however. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************