zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane_chazelas@yahoo.fr>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>, Ismail Donmez <ismail@namtrac.org>
Subject: Re: Interesting zsh behaviour regarding awk and backslash
Date: Tue, 27 Sep 2011 19:11:34 +0100	[thread overview]
Message-ID: <20110927181134.GA5502@yahoo.fr> (raw)
In-Reply-To: <110927064822.ZM25007@torch.brasslantern.com>

2011-09-27 06:48:22 -0700, Bart Schaefer:
> On Sep 27,  1:54pm, Jeremie Roquet wrote:
> }
> } Why bother with gawk?
> } 
> } bash$ echo '\\'
> } \\
> } zsh$ echo '\\'
> } \
> 
> This isn't quoting behavior, it's "echo" behavior.  If you tell zsh to
> act like a standard shell, it does:
> 
> % ARGV0=sh zsh -f
> $ echo '\\'
> \\
> $  set -o | grep echo
> nobsdecho             off
> $ 

standard shells *are meant* to output "\", not "\\". bash is not
standard in that regard. So zsh should *not* change its behavior
when called as sh here.

UNIX (POSIX+XSI) mandates the "\", POSIX makes the behavior of
echo unspecified in that case ("\", "\\" and "ambiguous input"
outputs are all acceptable, echo shouldn't be used in POSIX
scripts where the arguments may contain "\" or start with "-n"
(use printf instead))

zsh is not POSIX (and same for bash) in that it doesn't
output "-e" when called as "echo -e".

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
for the spec.

-- 
Stephane


  reply	other threads:[~2011-09-27 18:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 11:42 İsmail Dönmez
2011-09-27 11:54 ` Jérémie Roquet
2011-09-27 11:55   ` İsmail Dönmez
2011-09-27 13:48   ` Bart Schaefer
2011-09-27 18:11     ` Stephane Chazelas [this message]
2011-09-27 13:51 ` Mikael Magnusson
2011-09-27 13:54   ` İsmail Dönmez
2011-09-27 14:18     ` Frank Terbeck
2011-09-27 14:20     ` Bart Schaefer
2011-09-27 14:25       ` İsmail Dönmez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110927181134.GA5502@yahoo.fr \
    --to=stephane_chazelas@yahoo.fr \
    --cc=ismail@namtrac.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).