in reply to Re^2: how to write a perl one liner?
in thread how to write a perl one liner?

I looked at it, but abandoned it when I remembered xargs. It has the same problem as my earlier solutions unless you unset env var IFS. (I think prefixing the whole thing with "IFS=" will do the trick.)

Additionally, I think xargs will report non-zero exit codes, whereas the bash loop solutions don't without more code.

Replies are listed 'Best First'.
Re^4: how to write a perl one liner?
by ambrus (Abbot) on Mar 08, 2011 at 19:05 UTC

    It has the same problem as my earlier solutions unless you unset env var IFS.

    I can't see how IFS would figure in this. The read builtin is passed only one name so it will read all of the line (except the newline) into a single variable, and as we double-quote that variable later, it's always passed as a single argument to the command.

    Additionally, I think xargs will report non-zero exit codes, whereas the bash loop solutions don't without more code.

    That's true, yes.

      The read builtin is passed only one name so it will read all of the line (except the newline) into a single variable

      You're right. I misread or misinterpreted "with leftover words and their intervening separators assigned to the last name.", and proceeded to run what must have been a bad test.