mirror of
https://github.com/notwa/rc
synced 2024-10-18 02:11:25 -07:00
move inner loop out of outer loop
This commit is contained in:
parent
2765054c9f
commit
8f5934e864
1 changed files with 24 additions and 24 deletions
48
update
48
update
|
@ -137,31 +137,31 @@ for d in home sh vim; do
|
||||||
discover "$d" > _new/hashes.txt ||
|
discover "$d" > _new/hashes.txt ||
|
||||||
die 'failed to find new files'
|
die 'failed to find new files'
|
||||||
|
|
||||||
different < _new/hashes.txt > _new/updates.txt ||
|
different < _new/hashes.txt >> _new/updates.txt ||
|
||||||
die 'failed to compare files'
|
die 'failed to compare files'
|
||||||
|
|
||||||
LC_ALL=C sort < _new/updates.txt > _new/sorted.txt ||
|
|
||||||
die 'failed to sort file paths'
|
|
||||||
|
|
||||||
while read -r f; do
|
|
||||||
desire "$f" || continue
|
|
||||||
|
|
||||||
if [ -f "_new/$f" ] && ! [ -f "$f" ]; then
|
|
||||||
warn " + $f"
|
|
||||||
cp -p "_new/$f" "$f"
|
|
||||||
elif ! [ -f "_new/$f" ] && [ -f "$f" ]; then
|
|
||||||
warn " - $f"
|
|
||||||
elif [ "_new/$f" -nt "$f" ]; then
|
|
||||||
# NOTE: this does not play well with git --patch.
|
|
||||||
# don't use this script when you have git!
|
|
||||||
warn " * $f"
|
|
||||||
backup "$f"
|
|
||||||
cp -p "_new/$f" "$f"
|
|
||||||
elif [ "_new/$f" -ot "$f" ]; then
|
|
||||||
warn " / $f"
|
|
||||||
#else warn " = $f"
|
|
||||||
fi
|
|
||||||
done < _new/sorted.txt
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
LC_ALL=C sort < _new/updates.txt > _new/sorted.txt ||
|
||||||
|
die 'failed to sort file paths'
|
||||||
|
|
||||||
|
while read -r f; do
|
||||||
|
desire "$f" || continue
|
||||||
|
|
||||||
|
if [ -f "_new/$f" ] && ! [ -f "$f" ]; then
|
||||||
|
warn " + $f"
|
||||||
|
cp -p "_new/$f" "$f"
|
||||||
|
elif ! [ -f "_new/$f" ] && [ -f "$f" ]; then
|
||||||
|
warn " - $f"
|
||||||
|
elif [ "_new/$f" -nt "$f" ]; then
|
||||||
|
# NOTE: this does not play well with git --patch.
|
||||||
|
# don't use this script when you have git!
|
||||||
|
warn " * $f"
|
||||||
|
backup "$f"
|
||||||
|
cp -p "_new/$f" "$f"
|
||||||
|
elif [ "_new/$f" -ot "$f" ]; then
|
||||||
|
warn " / $f"
|
||||||
|
#else warn " = $f"
|
||||||
|
fi
|
||||||
|
done < _new/sorted.txt
|
||||||
|
|
||||||
clean
|
clean
|
||||||
|
|
Loading…
Reference in a new issue