Login
From:
David Winterbottom's TILs
(Uncensored)
subscribe
That `while read` loops ignore single line inputs (with no newline character)
https://til.codeinthehole.com/posts/that-while-read-loops-in-bash-dont-read-lines-with-no-new-line-character/
links
backlinks
Roast topics
Find topics
Find it!
A Bash script I was working on had a while read loop that processed Git commit SHAs: git log --pretty=format:'%H' $OPTIONS | while read -r line; do ... done but it did nothing when the git log command only piped one SHA in. Why?