Hi,

Is this behavior considered normal?

[EMAIL PROTECTED] ~]$ for k in "a b" c ; do echo $k ; done
a b
c
[EMAIL PROTECTED] ~]$ echo \"a b\" c
"a b" c
[EMAIL PROTECTED] ~]$ for k in `echo \"a b\" c` ; do echo $k ; done
"a
b"
c
[EMAIL PROTECTED] ~]$ bash --version
GNU bash, version 3.2.17(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[EMAIL PROTECTED] ~]$

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


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to