[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Command Substitution
From: |
Kevin Connor Arpe |
Subject: |
[Help-bash] Command Substitution |
Date: |
Sun, 24 Nov 2013 12:34:57 +0800 |
Hello,
I am seeking clarification about the Bash 4.2 man page. I downloaded
the latest source and built a binary from scratch on Linux.
Section "Command Substitution" has the following sentence:
"If the substitution appears within double quotes, word splitting and
pathname expansion are not performed on the results."
Unless I misunderstand, this sentence is inconsistent with the following:
$ bash
$ echo $BASH_VERSION
4.2.0(2)-release
$ var="data
> more data"
$ echo $var
data more data
$ echo "[$var]"
[data
more data]
# ^^^ Should be '[data more data]'?
$ var2=$(echo "$var")
$ echo $var2
data more data
$ echo "[$var2]"
[data
more data]
# ^^^ Should be '[data more data]'?
$ bash
$ var3="$(echo "$var")"
$ echo $var3
data more data
$ echo "[$var3]"
[data
more data]
Please help to clarify.
Thanks,
Kevin Connor ARPE
Hongkong
- [Help-bash] Command Substitution,
Kevin Connor Arpe <=