From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24744 invoked by alias); 18 Mar 2011 14:32:51 -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: 15881 Received: (qmail 6963 invoked from network); 18 Mar 2011 14:32:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=EqiiKpNV9Ve0o+YKcJJaCUbyATEKht9BzZNcTms8UWU=; b=gqtMDe5/45z4O7IK1ezjhiEt/REOQkgRVXCpBRjGeHEOD/4BX4RzLzGQNklutUuU4+ ufmcmAz+7t96nlCMMaE/AluQLuny0HT1x7LALTJ+JM1VTB3tVnvnJjjhYEJBykCNTJmw +55u5fF3jSKI29cal7F75Vyd5OFHRGi+GWw6M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=SIhDkXKKILPJKPh7LPlcI2c4td8VPBPjmPxPeRCjKFwoxRlO5q95YNbld00nBnoReg Y5OOn4lE33plcMcUpT/BNxmWa9jvH/8tgIsz7clWZkG940UT1VmraDVI3Ami9igbiZpN fXiyWh+lMnrCZjPWIPmdi1LPvLQsOpOL6i24g= MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 18 Mar 2011 15:32:43 +0100 Message-ID: Subject: Re: A hyphen bug or not? From: Mikael Magnusson To: nix@myproxylists.com Cc: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 18 March 2011 15:15, wrote: > #!/bin/zsh > > emulate zsh > > R="-" > > echo "$R" # <--- its empty here as well ! > > R=$(echo "$R" | base64) > R=$(print ${R//$'\n'}) > > echo "R: $R" # <--- this is wrong, it should be a hyphen - > > # When we change the "R" variable to a octal presentation of hyphen > > R="\055" > R=$(echo "$R" | base64) > R=$(print ${R//$'\n'}) > > echo "R: $R" # <--- now it works and base64 decod returns a hyphen "-" as > it should. > > > How I can echo a hyphen without echoing octal? Your problem is that echo actually interprets options, if you want to echo arguments starting with a hyphen you should use echo - "arguments here" (it's always safe to add the leading hyphen to separate options from arguments). If you also don't want to interpret escapes, use echo -E - "arguments here". -- Mikael Magnusson