On Thu, 16 Sep 2004, Alfred M. Szmidt wrote:

>Could someone explain the following behaviour for me?  Because I sure
>do not understand it.
>
>[EMAIL PROTECTED]:/tmp/foo$ touch 1 2 3 4 5
>[EMAIL PROTECTED]:/tmp/foo$ foo=`ls`

Here, ls knows it is not outputting to a terminal, so implies the "-1"
option.

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

Here the shell splits up the arguments and /bin/echo sees argc==5 (or it
it 6 to include argv[0]?).

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

Here the shell passes the single argument and /bin/echo sees argc==1.


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

These shouldn't cause any surprises, I hope.


Cheers,
Phil


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

Reply via email to