mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-03 23:43:40 +02:00
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
This commit is contained in:
parent
eeaccf6508
commit
972c227fd7
1 changed files with 2 additions and 4 deletions
|
@ -320,12 +320,10 @@ update_userjs () {
|
||||||
diff=$(sdiff -s -w 1000 $past_nocomments $current_nocomments)
|
diff=$(sdiff -s -w 1000 $past_nocomments $current_nocomments)
|
||||||
if [ ! -z "$diff" ]; then
|
if [ ! -z "$diff" ]; then
|
||||||
local leasttabs=999999
|
local leasttabs=999999
|
||||||
local oldIFS=$IFS
|
while read -r; do
|
||||||
while IFS= read -r line; do
|
ntabs=$(printf '%s\n' "$REPLY" | tr -c -d "\t" | wc -c)
|
||||||
ntabs=$(printf '%s\n' "$line" | tr -c -d "\t" | wc -c)
|
|
||||||
if [ $ntabs -lt $leasttabs ]; then leasttabs=$ntabs; fi
|
if [ $ntabs -lt $leasttabs ]; then leasttabs=$ntabs; fi
|
||||||
done <<< "$diff"
|
done <<< "$diff"
|
||||||
IFS=$oldIFS
|
|
||||||
if [ $leasttabs -lt 2 ]; then
|
if [ $leasttabs -lt 2 ]; then
|
||||||
echo "$diff" > "$diffname"
|
echo "$diff" > "$diffname"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue