On 11/29/11 8:29 AM, Greg Wooledge wrote: > There are many bash scripts in use already that rely on read -d '' to > work the way it does. Switching the behavior of -d '' and introducing > -d '\0' in its place would require rewriting all of those scripts. > > The final decision is Chet's, but losing the ability to read a > NUL-delimited stream would be a huge problem for me. Neither POSIX sh > nor ksh has the ability to handle NUL-delimited input, as far as I have > been able to determine. I don't know zsh, so maybe it does, or maybe not.
It's possible to have both. You can handle matching a NUL delimiter and skip NUL bytes in the input if the delimiter isn't NUL. That allows the bash behavior and compatibility with other shells that don't provide `-d'. There is already `read -n 1' to read only a single character from the input stream. I don't see much value in translating '\0' to 0 for `-d'. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/