From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16767 invoked by alias); 18 Mar 2011 17:21:07 -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: 15882 Received: (qmail 14525 invoked from network); 18 Mar 2011 17:21:04 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at myproxylists.com designates 217.119.39.74 as permitted sender) X-Originating-IP: 127.0.0.1 Message-ID: <9d2a9fce17a22ad2827daf41f5cd0650.squirrel@gameframe.net> In-Reply-To: References: Date: Fri, 18 Mar 2011 19:21:00 +0200 Subject: Re: A hyphen bug or not? From: nix@myproxylists.com To: "Mikael Magnusson" Cc: zsh-users@zsh.org User-Agent: SquirrelMail/1.4.20 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal > 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 > R="-" echo - "$R" did the trick. Thank you.