From 972c227fd71c24dcdeb0c4bbaa25417540fec42c Mon Sep 17 00:00:00 2001 From: earthlng Date: Mon, 26 Nov 2018 19:32:30 +0000 Subject: [PATCH] Update updater.sh > If you do not give `read` any arguments to use to hold the input (relying on the default variable `REPLY`), no whitespace is stripped and you can omit the modification to `IFS`. That is, `while read -r; do printf '%s\n' "$REPLY"; done < "$file"` from a comment by chepner in response to the answer at https://stackoverflow.com/a/29689199 thanks chepner --- updater.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/updater.sh b/updater.sh index f0551f7..ba44f8e 100755 --- a/updater.sh +++ b/updater.sh @@ -320,12 +320,10 @@ update_userjs () { diff=$(sdiff -s -w 1000 $past_nocomments $current_nocomments) if [ ! -z "$diff" ]; then local leasttabs=999999 - local oldIFS=$IFS - while IFS= read -r line; do - ntabs=$(printf '%s\n' "$line" | tr -c -d "\t" | wc -c) + while read -r; do + ntabs=$(printf '%s\n' "$REPLY" | tr -c -d "\t" | wc -c) if [ $ntabs -lt $leasttabs ]; then leasttabs=$ntabs; fi done <<< "$diff" - IFS=$oldIFS if [ $leasttabs -lt 2 ]; then echo "$diff" > "$diffname" else