In Bash, the following command
echo foo | while read line; do echo $line; done
outputs foo
; however, the following
alias bar="echo foo | while read line; do echo $line; done"
bar
outputs a \n
(or empty space). What is causing this difference in behavior?
read
correctly) and https://unix.stackexchange.com/questions/68694 (about quoting correctly). – Kusalananda Dec 30 '20 at 17:55