This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: wordexp IFS fixes
Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> writes:
> Ulrich Drepper <drepper@cygnus.com> writes:
> |>
> |> We don't have many comparisons available. All systems I've tried
> |> (Solaris, DU, Irix) completely fail to recognize IFS. Loosers.
>
> IFS=:; foo=:abc:; set $foo
Under Solaris ksh, it sets the arguments to "" "abc" (i.e., $# is 2).
Solaris sh sets "abc" ($# is 1). Duh.
For even more fun, "set $foo bar" (sh) does _the same_, i.e. it completely
ignores the "bar". Using ksh, $2 is "bar" and $# is 3. Fun.
The shell is, however, free to ignore trailing $IFS characters (which makes
a lot of sense if you assign the result of a command expansion to a
variable or, worse, a shell array). This is, AFAIR, specified in the
appropriate Posix document. Therefore, IMHO the correct results should be
IFS=":"
foo=":bar:"; set $foo => "" "bar"
foo=":bar:"; set one $foo two => "one" "" "bar" "" "two"
--
Matthias Urlichs | noris network GmbH | smurf@noris.de
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
Have you noticed the way people's intelligence capabilities decline
sharply the minute they start waving guns around?
-- Dr. Who