bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: empty lines at the end of quoted command subsitutions missing


From: Pierre Gaston
Subject: Re: empty lines at the end of quoted command subsitutions missing
Date: Sat, 24 Jul 2010 12:38:58 +0300

On Sat, Jul 24, 2010 at 10:23 AM, Andreas Schwab <address@hidden> wrote:
> address@hidden writes:
>
>> empty line(s) at the end of quoted command subsitutions are missing:
>
> That is not a bug, but a feature.  Command subsitution generally strips
> trailing newlines from the output of the command.  If you want the
> complete output use a pipe.
>

It's probably intuitively what you expect when you do
  var=$(echo a); echo "$var"
In this case most people would expect 1 newline and not 2
(one from the first echo in $( ) and the second from the second echo)

You can also use a trick like: var=$(command;printf e) var=${var%e}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]