I need to pipe data into a while loop in a bash script, but it keeps trimming the whitespace. For example:
echo " test" | while read i; do echo "$i"; done
How can I prevent it from doing this?
Thanks!
echo " test" | while IFS= read i; do echo "$i"; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With