[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@)
From: |
Steffen Nurpmeso |
Subject: |
Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@) |
Date: |
Sat, 24 Aug 2024 02:15:48 +0200 |
User-agent: |
s-nail v14.9.25-599-g5c75a327b2 |
Sorry but i really have to come again, i do not understand what is
going on, and *i* think shell is at fault.
This:
a() {
echo $#,1=$1,2=$2,"$*",$*,
}
echo "$*"$* $*; a "$*"$* $*
echo __
IFS=:;echo "$*"$* $*; a "$*"$* $*;unset IFS
echo ==
set -- a b c
echo "$*"$* $*; a "$*"$* $*
echo 0
IFS=:; echo "$*"$* $*; a "$*"$* $*;unset IFS
gives this output:
1,1=,2=,,,
__
1,1=,2=,,,
==
a b ca b c a b c
6,1=a b ca,2=b,a b ca b c a b c,a b ca b c a b c,
0
a:b:ca b c a b c
6,1=a b ca,2=b,a:b:ca:b:c:a:b:c,a b ca b c a b c,
Compared to the output of my MUA this is
@@ -8,4 +8,4 @@ a b ca b c a b c
6,1=a b ca,2=b,a b ca b c a b c,a b ca b c a b c,
0
a:b:ca b c a b c
-6,1=a b ca,2=b,a:b:ca:b:c:a:b:c,a b ca b c a b c,
+6,1=a:b:ca,2=b,a:b:ca:b:c:a:b:c,a b ca b c a b c,
Why does bash, when preparing the first argument to the function
a(), ie, when word-splitting "$*", not generate "a:b:c" as it very
well does when it creates the output for echo(1)?
Where is the difference in between the '"$*"$* $*' of the one
argument, and the '"$*"$* $*' of the other?
In both cases $* is in between quotes and needs to be expanded
with the first byte (character) of $IFS as a separator, this is
what i do not understand. Is this a bug in bash? What rule am
i missing if not?
Thank you very much.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
- Question on differences on quoted $* (Was: Re: Question on $@ vs $@$@),
Steffen Nurpmeso <=