From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25661 invoked from network); 24 Mar 2005 01:34:51 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Mar 2005 01:34:51 -0000 Received: (qmail 40403 invoked from network); 24 Mar 2005 01:34:45 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Mar 2005 01:34:45 -0000 Received: (qmail 10400 invoked by alias); 24 Mar 2005 01:34:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21060 Received: (qmail 10390 invoked from network); 24 Mar 2005 01:34:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 24 Mar 2005 01:34:43 -0000 Received: (qmail 40104 invoked from network); 24 Mar 2005 01:34:43 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 24 Mar 2005 01:34:39 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IDU00BC51PL0250@vms048.mailsrvcs.net> for zsh-workers@sunsite.dk; Wed, 23 Mar 2005 19:34:34 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j2O1YW7L015896 for ; Wed, 23 Mar 2005 17:34:33 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j2O1YWup015895 for zsh-workers@sunsite.dk; Wed, 23 Mar 2005 17:34:32 -0800 Date: Thu, 24 Mar 2005 01:34:32 +0000 From: Bart Schaefer Subject: Re: there should be a way to echo with quotes or escaping In-reply-to: To: zsh-workers@sunsite.dk Message-id: <1050324013432.ZM15894@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: Comments: In reply to Dave Yost "there should be a way to echo with quotes or escaping" (Mar 23, 2:00pm) 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 On Mar 23, 2:00pm, Dave Yost wrote: } } If there is such a feature, I didn't see it mentioned under the echo } command in the man page. The way to do this is with parameter expansion: Z% raw="abc def" Z% echo ${(q)raw} abc\ def Z% echo ${(qq)raw} 'abc def' Z% echo ${(qqq)raw} "abc def" Z% echo ${(qqqq)raw} $'abc def' (More than four "q"s doesn't change anything after that.) To skip the assignment to "raw", just: Z% echo ${(q):-"abc def"} abc\ def Of course you're really better off using "print -R" than "echo", because "echo" may re-interpret backslashes etc. embedded in its arguments.