help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] The difference between $* and "$*"?


From: Chet Ramey
Subject: Re: [Help-bash] The difference between $* and "$*"?
Date: Mon, 03 Feb 2014 11:19:32 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/3/14 8:59 AM, Eric Blake wrote:
> On 02/02/2014 01:58 PM, Chet Ramey wrote:
>> On 2/1/14, 1:58 PM, Seth David Schoen wrote:
>>> Peng Yu writes:
>>>>
>>>> I'm trying to understand the different between $* and "$*". The
>>>> following shows that they behave differently when IFS is not the
>>>> default. But the above paragraph from the manual does not explain
>>>> this. Could anybody let me know if this is documented somewhere else
>>>> in the manual and how to understand the difference? Thanks.
>>>
>>> Hi,
>>>
>>> The difference is whether it "expands to a single word" or to multiple
>>> words.
>>
>> Would it help to add this sentence?
>>
>> "When not within double quotes, each positional parameter expands to a
>> separate word."
>>
>> It seems to me that that could have eliminated the confusion.
> 
> No, because that's not quite true.  Eliminating the quotes means that
> positional parameters are ALSO subject to word-splitting:

Sure.  It's not complete.  However, it would have eliminated the confusion
in this case.

And it's not just word splitting, it's pathname expansion as well -- just
like the output of any other unquoted word expansion.  The point is to
make the point that $* is, when unquoted, more like other word expansions
than the special double-quoted behavior the rest of the paragraph
describes.

Chet

- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlLvwZMACgkQu1hp8GTqdKuNigCfdUg/Zjh953AiMolP1CVDgEQA
D4wAn3FhZZeENP4kdIFUwkNqI1OSDu11
=ZyvF
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]