Andreas Schwab wrote: > [EMAIL PROTECTED] (Bob Proulx) writes: > > But when this is used with a command substitution the newline > > disappears. > > Command substitution always strips trailing newlines.
Here is the part that I have previously missed: man bash Command Substitution ... Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. And this follows POSIX: http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03 The shell shall expand the command substitution by executing command in a subshell environment (see Shell Execution Environment) and replacing the command substitution (the text of command plus the enclosing "$()" or backquotes) with the standard output of the command, removing sequences of one or more <newline>s at the end of the substitution. I somehow missed this when I was researching it previously. Thanks! Bob _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash