I try to get some data from sysin and here is my problem: if data are directed from a file, then the last line is not read.
Example of text file:
while read line
$ ./test.sh < data.txt
If you need desperately to read files without EOL in the end, then you may check whether returned string is empty or not instead of checking
read exit status:
#!/bin/bash while true; do line='' read line if [ -z "$line" ]; then break fi echo "$line" done