On 3/29/15 5:03 AM, isabella parakiss wrote: > $ read -n 100 a b <<< 'x y'; declare -p a b > declare -- a="x" > declare -- b="y" > $ read -N 100 a b <<< 'x y'; declare -p a b > declare -- a="x y > " > declare -- b="" > > From my understanding of the documentation, read -N should ignore the > delimiter (-d), not the IFS. If the current behaviour is correct, a > better wording may be helpful.
Yes, it appears that the current wording leads to invalid assumptions about the behavior of -N. The feature is implemented as Richard Stallman originally requested it: "We want to make a shell script reliably read the first few characters from standard input and save them in a variable...I suggest an option for `read' that says to read exactly a certain number of characters. Perhaps `read -c NUMBER'." There was some back-and-forth back in late 2009 about features and syntax and the current implementation is the result. I proposed a combination of -n, -d DELIM, and $REPLY, but rms's request was for a more general mechanism. (-N does not imply -r, though maybe, in hindsight, it should have.) The text reading "read exactly N characters" was intended to imply this, but I can make it more explicit. 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/