Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    The bash one removes the last field if it's empty (bash's read -a can't be used for reading separated values) while the perl one removes all empty trailing fields. Commented Jun 23, 2021 at 8:03
  • The bash one assumes $IFS contains its default value, the xpg_echo option is not enabled and/or input lines are not things like -neen..., both assume that words in the name field are whitespace separated (only space and tab in the bash one) and will mangle spacing there. (not worse than the OP's attempt though in those regards) Commented Jun 23, 2021 at 8:08
  • Note that the perl one assumes ASCII-only input. Commented Jun 23, 2021 at 8:09