[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weird echo behaviour...
From: |
Philip Rowlands |
Subject: |
Re: weird echo behaviour... |
Date: |
Thu, 16 Sep 2004 16:35:32 +0100 (BST) |
On Thu, 16 Sep 2004, Alfred M. Szmidt wrote:
>Could someone explain the following behaviour for me? Because I sure
>do not understand it.
>
>address@hidden:/tmp/foo$ touch 1 2 3 4 5
>address@hidden:/tmp/foo$ foo=`ls`
Here, ls knows it is not outputting to a terminal, so implies the "-1"
option.
>address@hidden:/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]?).
>address@hidden:/tmp/foo$ /bin/echo "$foo"
>1
>2
>3
>4
>5
Here the shell passes the single argument and /bin/echo sees argc==1.
>address@hidden:/tmp/foo$ foo='1 2 3 4 5'
>address@hidden:/tmp/foo$ /bin/echo $foo
>1 2 3 4 5
>address@hidden:/tmp/foo$ /bin/echo "$foo"
>1 2 3 4 5
These shouldn't cause any surprises, I hope.
Cheers,
Phil
- Re: weird echo behaviour..., (continued)
- Re: weird echo behaviour..., Bob Proulx, 2004/09/16
- Re: weird echo behaviour..., Andreas Schwab, 2004/09/16
- Re: weird echo behaviour..., Dmitry V. Levin, 2004/09/17
- Re: weird echo behaviour..., P, 2004/09/17
- Re: weird echo behaviour...,
Philip Rowlands <=