Alfred M. Szmidt wrote:
Could someone explain the following behaviour for me?  Because I sure
do not understand it.

Yes this is confusing but not incorrect.

[EMAIL PROTECTED]:/tmp/foo$ touch 1 2 3 4 5
[EMAIL PROTECTED]:/tmp/foo$ foo=`ls`

$foo will contain the string 1\n2\n3\n4\n5\n

[EMAIL PROTECTED]:/tmp/foo$ /bin/echo $foo
1 2 3 4 5

This will first parse the string into seperate parameters to pass to echo which it outputs with spaces in between

[EMAIL PROTECTED]:/tmp/foo$ /bin/echo "$foo"
1
2
3
4
5

The quotes stop the parsing of the string into seperate params, so echo will output the unparsed string containing newlines.

Pádraig.


_______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to