On Fri, Aug 15, 2025 at 11:58 AM Chet Ramey <chet.ra...@case.edu> wrote: > > The semantic issue is different. Should the shell simply ignore an attempt > to make IFS into an array, and treat it as if IFS were unset, or should it > use IFS[0] as the set of delimiter characters?
In the general case, bash treats var and var[0] as the same thing, from the user's perspective. If the resulting indexed or associative array lacks an element at index 0, then IFS should be treated as unset. Else use IFS[0]. The trouble is, you'd potentially have to also implement this behavior for all the other special shell variables. The existence of an ifs_value pointer is a little surprising to me. Is it faster to check if every shell variable assignment is an assignment to IFS and then point ifs_value at that value if it is than to simply dereference the IFS shell variable each time it's needed?