The output of the command below is weird to me. Why does it not give me back element 5?
$ echo '0,1,2,3,4,5' | while read -d, i; do echo $i; done
0
1
2
3
4
I would expect '5' to be returned as well. Running GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
. Adding a comma works, but my input data does not have a comma. Am I missing something?
read -d, i || [[ -n $i ]]
a la What doeswhile read -r line || [[ -n $line ]]
mean? – steeldriver May 17 '19 at 11:18