[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Command Substitution
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Command Substitution |
Date: |
Mon, 25 Nov 2013 08:06:26 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Nov 24, 2013 at 12:10:26PM +0100, Davide Brini wrote:
> > $ var2=$(echo "$var")
>
> Word splitting is NOT performed upon assignment (this is noted elsewhere in
> the manual), so var2 is an exact copy of var.
Almost. The echo will add one trailing newline, and then the command
substitution will remove ALL trailing newlines. If var happened to
contain a trailing newline already, then the copy in var2 would be
slightly altered.