Re: `read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Chet Ramey
Jan Schampera wrote: Scott Mcdermott wrote: Bash does not seem to take the last record if it has no trailing delimiter: I'm sure Chet accepts patches, if he thinks it's a bug. I'm not sure if it's a bug per se, but at least it's a usability issue to discuss. Maybe it can be reduced to "read re

Re: `read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Chris F.A. Johnson
On 2008-02-24, Scott Mcdermott wrote: > Bash does not seem to take the last record if it has no > trailing delimiter: > > > $ echo "0 1 2^3 4 5^6 7 8" | > while read -a array -d ^ > do echo $array > done > 0 3 > > In this sense it does not behave like awk: > > $ echo "

Re: `read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Jan Schampera
Scott Mcdermott wrote: > Bash does not seem to take the last record if it has no > trailing delimiter: > > > $ echo "0 1 2^3 4 5^6 7 8" | > while read -a array -d ^ > do echo $array > done > 0 3 > This behavior is counter-intuitive. It just throws away the > last line

`read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Scott Mcdermott
Bash does not seem to take the last record if it has no trailing delimiter: $ echo "0 1 2^3 4 5^6 7 8" | while read -a array -d ^ do echo $array done 0 3 In this sense it does not behave like awk: $ echo "0 1 2^3 4 5^6 7 8" | awk -v RS=^ '{print $1}' 0 3