improve quoting
This commit is contained in:
parent
26e1abc733
commit
a09a285186
1 changed files with 7 additions and 6 deletions
13
update
13
update
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
url="$1"
|
url="$1"
|
||||||
pad="$(basename $url).txt"
|
pad="$(basename "$url").txt"
|
||||||
dst="$pad"
|
dst="$pad"
|
||||||
gitdir="$(dirname $dst)"
|
gitdir="$(dirname "$dst")"
|
||||||
|
|
||||||
curl --silent -k -o "${dst}" "${url}/export/txt"
|
curl --silent -k -o "${dst}" "${url}/export/txt"
|
||||||
status="$?"
|
status="$?"
|
||||||
|
@ -13,7 +13,7 @@ update() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
newlength="$(wc -l < ${dst})"
|
newlength="$(wc -l < "${dst}")"
|
||||||
if [ "$newlength" -lt 3 ]
|
if [ "$newlength" -lt 3 ]
|
||||||
then
|
then
|
||||||
echo "Skipping update of ${url}, because pad has likely been removed"
|
echo "Skipping update of ${url}, because pad has likely been removed"
|
||||||
|
@ -22,11 +22,12 @@ update() {
|
||||||
|
|
||||||
git -C "${gitdir}" add "${dst}"
|
git -C "${gitdir}" add "${dst}"
|
||||||
changes=$(git -C "${gitdir}" diff --cached | wc -l)
|
changes=$(git -C "${gitdir}" diff --cached | wc -l)
|
||||||
if [ "$changes" -gt 0 ]; then
|
if [ "$changes" -lt 1 ]; then
|
||||||
git -C "${gitdir}" commit -m "Updated: ${dst} from ${url}"
|
|
||||||
else
|
|
||||||
echo "Nothing changed for ${url}"
|
echo "Nothing changed for ${url}"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
git -C "${gitdir}" commit -m "Updated: ${dst} from ${url}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! git rev-parse --is-inside-work-tree
|
if ! git rev-parse --is-inside-work-tree
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue