Stephane Chazelas dixit:

>$ IFS=:
>$ set ${0+:foo:bar}
>$ echo $#
>2

>Expected:
>3

You know, I *loathe* IFS word splitting.

So what’s the rule here? Leading IFS in the variable
after expanding it should be… skipped? Not generate
a field? And leading IFS from the replacement counts?

Or is this about IFS WS vs. IFS NWS?

tglase@tglase:~ $ mksh -c 'IFS=:; set ${0+:foo:bar}; echo $#'
2
tglase@tglase:~ $ ksh93 -c 'IFS=:; set ${0+:foo:bar}; echo $#'
3

tglase@tglase:~ $ mksh -c 'set ${0+ foo bar}; echo $#'
2
tglase@tglase:~ $ ksh93 -c 'set ${0+ foo bar}; echo $#'
2

I don’t get it. And unfortunately, the famous ifs.sh does not
have a testcase for the issue in the first place. (The issue
was IFS-subst-2 and glob-trim-1 in the testsuite.)

Anyway, thanks for reporting…

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Reply via email to