[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on $@ vs $@$@
From: |
Robert Elz |
Subject: |
Re: Question on $@ vs $@$@ |
Date: |
Sat, 17 Aug 2024 03:50:36 +0700 |
Date: Thu, 15 Aug 2024 23:33:42 +0200
From: Steffen Nurpmeso <steffen@sdaoden.eu>
Message-ID: <20240815213342.t6-hdjZT@steffen%sdaoden.eu>
| I have extended the test a bit, and i also see word split
| differences.
There are so many problems with this test, that I'm not sure
it is worth bothering looking to see what happens, or why there
are differences.
| x ''
| eval x ''
You do realise that the 2nd of those is simply "x" right?
| IFS=: x $i
And this enters unspecified behaviour, as it isn't specified
whether the assignment to IFS is used or not when expanding $i
for the call to x. I'm not sure what you were intending to
have happen here, but that might be it.
It is also unspecified (though shouldn't be, but it is) whether
variable assigments preceding a function call remain visible in
the shell after the function has returned. So, in some shells
the sequence
IFS=: x $i
IFS=: eval x $i
might expand $i using : and in others, whatever IFS was set to
previously, and in some shells that assignment to IFS (on the
first line) might be used when expanding $i in the second call.
In other shells the expansion of $i (in both cases) might depend
upon the previous (intended to be global) value of IFS, and those
var-assigns might only affect what happens inside x, and anything it
calls (y) in this case.
In others the var-assign might be used when doing the expansions of
the args in all cases.
I think you need to rethink the test, and make sure you are doing
things in a sane fashion (like not using var-assigns before function
calls at all) and then see what happens.
But also note that when expanding $@ or $* (unquoted) the standard
says it is a "may" for removing empty fields that are produced, not
a requirement. ie: different shells are likely to do different things
there as well.
kre
- Re: Question on $@ vs $@$@, (continued)
Re: Question on $@ vs $@$@, Oğuz, 2024/08/14
Re: Question on $@ vs $@$@, Robert Elz, 2024/08/14
Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/14
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/14
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/15
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/15
- Re: Question on $@ vs $@$@,
Robert Elz <=
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/16
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/16
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/22
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/22
- Re: Question on $@ vs $@$@, Greg Wooledge, 2024/08/22
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/23
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/26
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/26
- Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/27
- Re: Question on $@ vs $@$@, Steffen Nurpmeso, 2024/08/27