[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IFS field splitting doesn't conform with POSIX
From: |
Kerin Millar |
Subject: |
Re: IFS field splitting doesn't conform with POSIX |
Date: |
Sun, 2 Apr 2023 06:51:40 +0100 |
On Sun, 02 Apr 2023 09:32:20 +0700
Robert Elz <kre@munnari.OZ.AU> wrote:
> Date: Sat, 1 Apr 2023 19:44:10 -0400
> From: Saint Michael <venefax@gmail.com>
> Message-ID:
> <CAC9cSOAA0g97fzuLuRXmee6EmRdUm7zPzk+U20YMvWbJyMVdng@mail.gmail.com>
>
> | The compelling reason is: I may not know how many values are stored in the
> | comma-separated list.
>
> Others have told you you're wrong, but this is not any kind of compelling
> reason - you simply give one more variable name than you expected to need
> (than you would have used otherwise) and then all the extra fields that
> you wanted the shell to ignore will be assigned to it - which you are free
> to ignore if you like, or you can test to see if anything is there, and
> issue an error message (or something) if more fields were given than you
> were expecting. Much better behaviour than the shell simply ignoring
> data (silently).
I would add to this that bash affords one the luxury of using read -a before
proceeding to check the size of the resulting array.
--
Kerin Millar