[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] The difference between $* and "$*"?
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] The difference between $* and "$*"? |
Date: |
Sun, 2 Feb 2014 14:09:33 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Chet Ramey wrote:
> 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.
> >
> > 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.
I like it? I assume you mean right after the first sentence? As in
then it would read like this (minus word wrap formating):
* Expands to the positional parameters, starting from one.
When not within double quotes, each positional parameter
expands to a separate word.
When the expansion occurs within double quotes, it
expands to a single word with the value of each
parameter separated by the first character of the IFS
special variable. That is, "$*" is equivalent to
"$1c$2c...", where c is the first character of the value
of the IFS variable. If IFS is unset, the parameters
are separated by spaces. If IFS is null, the parameters
are joined without intervening separators.
I think that would be great.
Bob
- [Help-bash] The difference between $* and "$*"?, Peng Yu, 2014/02/01
- Re: [Help-bash] The difference between $* and "$*"?, Seth David Schoen, 2014/02/01
- Re: [Help-bash] The difference between $* and "$*"?, Chet Ramey, 2014/02/02
- Re: [Help-bash] The difference between $* and "$*"?, Peng Yu, 2014/02/02
- Re: [Help-bash] The difference between $* and "$*"?, Eric Blake, 2014/02/03
- Re: [Help-bash] The difference between $* and "$*"?, Eric Blake, 2014/02/03
- Re: [Help-bash] The difference between $* and "$*"?, Chet Ramey, 2014/02/03
Re: [Help-bash] The difference between $* and "$*"?, Bob Proulx, 2014/02/01