Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug in zsh-2.6-beta21
- X-seq: zsh-workers 1443
- From: Hrvoje Niksic <hniksic@xxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (ZSH Workers Mailing List)
- Subject: Re: bug in zsh-2.6-beta21
- Date: 25 Jun 1996 21:15:55 +0200
- In-reply-to: Vincent Lefevre's message of Tue, 25 Jun 1996 20:55:26 +0200 (MET DST)
- References: <199606251855.UAA03602@xxxxxxxxxxxxxxxxxxxxx>
- Sender: hniksic@xxxxxxxxxxxxxx
Vincent Lefevre (Vincent.Lefevre@xxxxxxxxxxxxxxx) wrote:
> This is OK. But under zsh 2.6-beta21:
> 
> $ var=`echo "ab\ncd\nef"`
> $ echo $var
> ab
> cd
> ef
> $ var=`echo "ab\ncd\nef\n"`
> $ echo $var
> ab
> cd
> ef
> $
> 
> The last "\n" is not printed.
I think this is good behaviour sh, ksh and bash also strip trailing
newlines. It should maybe be documented in the manual. E.g. bash
manual states:
              $(command)
       or
              `command`
       Bash performs  the  expansion  by  executing  command  and
       replacing  the command substitution with the standard out-
       put of the command, with any trailing newlines deleted.
Whereas zsh manual says:
       A  command  enclosed  in  parentheses preceded by a dollar
       sign, like so: $(...) or quoted with grave accents:  `...`
       is replaced with its standard output.  If the substitution
       is not enclosed in double quotes,  the  output  is  broken
       into  words  using  the  IFS  parameter.  The substitution
Removing trailing newlines is *not* specifically mentioned.
-- 
hniksic@xxxxxxx              |  Student of electrical engineering
hniksic@xxxxxxxxxxxxx        |  University of Zagreb, Croatia
------------------------------------------------------------------
`VI' - An editor used by those heretics that don't subscribe to
       the Emacs religion.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author