[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Double quotes do not work in command substitution?
From: |
Dimitry Golubovsky |
Subject: |
Double quotes do not work in command substitution? |
Date: |
Tue, 3 Jul 2007 09:39:57 -0400 |
Hi,
Is this behavior considered normal?
[dima@amd64vm ~]$ for k in "a b" c ; do echo $k ; done
a b
c
[dima@amd64vm ~]$ echo \"a b\" c
"a b" c
[dima@amd64vm ~]$ for k in `echo \"a b\" c` ; do echo $k ; done
"a
b"
c
[dima@amd64vm ~]$ bash --version
GNU bash, version 3.2.17(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[dima@amd64vm ~]$
That is, when a doublequoted string containing whitespace appears
directly on the command line, it is treated properly ("a b" as one
token). When the same appears as part of command substitution, parts
of the doublequoted string are separated by space it contains, and we
have 3 tokens rather than 2.
If this is normal behavior, how can the desired be achieved, that is,
treat doublequoted strings from command substitution same way as if
they appeared on shell command line?
Thanks.
--
Dimitry Golubovsky
Anywhere on the Web
- Double quotes do not work in command substitution?,
Dimitry Golubovsky <=