Open vincentclee opened 4 years ago
This problem also occurs with python 2.7 on the latest version of Raspbian
The problem is not in python but in the run.sh logic:
$ echo -ne "a\nb" > shared/ips.txt
$ (while IFS='' read -r line;do echo "$line";done < shared/ips.txt)
a
$ cat -A shared/ips.txt
a$
b
Because 'read' by default uses newline as delimiter it only reads lines that have a newline at the end of the line.
A possible solution is to use a command that adds a newline to every printed line, e.g.
$ while read -r line;do echo "$line";done < <(grep "" shared/ips.txt)
(source: https://stackoverflow.com/a/31397871/7888054)
If this solution is ok for @Cloudflare I could create a PR.
Scenario 1: File with endline character shared/ips.txt
Scenario 2: File without endline character shared/ips.txt
run