i guess i am one of those opinionated people who thinks that a shell should also be a good programming language, and that certain things should be easy to do portably and correctly and with confidence that it is portable and correct.
imho it's bad that xargs is hard to write portably and with full attention to correctness (quoting, signals, reentrance, exit codes, variable shadowing, etc.), and it's bad when the user isn't sure whether something will work or not. imho basic things like an xargs or a truly raw read should be obvious, especially in a shell. "use a function that splits on ifs but set ifs first" is not entirely obvious. many of us do exactly that, but it is a convention rather than an obvious solution. at some point most noninteractive shell users will want to write such a loop. a person who thinks that languages should be designed to make obvious things obvious will assume that read is the wrong tool for the job, go on a wild goose chase trying to get line(1) to work, and ultimately abandon that route because of about 10 other limitations in the shells. only then will he go back to using read and ifs. and even then he will doubt its correctness. i hit on a solution that more or less works, but if the solution that i came up with (see my script in the original post) doesn't modify any lines (i.e. it is a truly raw read), then at the very least it would be helpful to have the man page say that if you want a truly raw read, it is safe to use ifs='\n' to get it. more broadly, it shouldn't be so time-consuming to do something like xargs correctly. i doubt that my solution above is even correct, although it works fine in normal circumstances. there are several solutions: implement xargs as a builtin, fix the other limitations, do a truly raw read without ifs, or, at the very least, add a sentence to the man pages. preferably while communicating with any bash people doing the same so that scripts can be portable. i hope that made it clear. if none of the solutions appeals to you, feel free to close the report. thanks. -- Webmaster: do you believe that people will (a) switch browsers to view your "best viewed with" page or (b) go to your competitor?