refactor slightly

(ensure): Don't repeat "$src/$fn" and "$dst/$fn";
instead, compute them once as "$src" and "$dst", respectively.
This commit is contained in:
Thien-Thi Nguyen 2022-06-30 03:32:29 -04:00
parent 2805018da2
commit f377076174
No known key found for this signature in database
GPG Key ID: 670322244C807502

View File

@ -17,13 +17,13 @@ ensure ()
# $2 -- src dir under contrib/ # $2 -- src dir under contrib/
# $3 -- dst dir under ./ # $3 -- dst dir under ./
fn="$1" fn="$1"
src="contrib/$2" src="contrib/$2/$fn"
dst="./$3" dst="./$3/$fn"
if ! diff $src/$fn $dst/$fn > /dev/null if ! diff $src $dst > /dev/null
then then
cp $src/$fn $dst/$fn cp $src $dst
chmod -w $dst/$fn chmod -w $dst
fi fi
} }