[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BASH Command substitution
From: |
Zoltan Mate |
Subject: |
BASH Command substitution |
Date: |
Thu, 17 Dec 2009 12:02:35 +0100 |
Dear Chet Ramey,
I have a conversation on an other bug forum, then have been directed
to here, I cannot find any documentation, why
$ echo $(echo "'alfa beta'")
gives 'alfa beta' whith reduced space, instead of the result of the
following more logical ways:
$ echo $(echo "'alfa beta'")
the second term suggests one parameter being substituted as
"<the output of the command>"
On the other hand, having made the substitution, one should get the
$ echo 'alfa beta'
text to be interpreted.
So why the '-s are quoted and the spaces are not?
This strange behaviour should be mentioned in the bash manual.
Zoltan Mate
----------------------------------------- The former conversation:
--------------------------------------------
bash command substitution reduce double spaces in strings:
$ echo $(echo "'alfa beta'")
'alfa beta'
Reproducible: Always
Steps to Reproduce:
------- Comment #1 From SpanKY 2009-12-16 19:32:24 0000 [reply] -------
the second isnt actually quoted which means you ran:
argv[] = {
"echo"
"'alfa"
"beta'"
}
------- Comment #2 From ZoliM 2009-12-17 09:41:08 0000 [reply] -------
Where is emphasized the text interpreatation process in the manual?
In
$ echo $(echo "'alfa beta'")
the second term suggests one parameter being substituted as
"<the output of the command>"
On the other hand, having made the substitution, one should get the
$ echo 'alfa beta'
text to be interpreted.
So I motion to mark in the documentation at the Command substitution chapter
the proper interpretation logic.
------- Comment #3 From SpanKY 2009-12-17 10:32:32 0000 [reply] -------
those two examples are not equivalent. your first snippet boils down to:
echo \'alfa beta\'
this bugzilla isnt a forum for teaching people how to script bash. if you want
further help, please ask on the bash mailing list, or the gentoo forums, or
some other suitable location.
- BASH Command substitution,
Zoltan Mate <=