summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Clausen <jac@nordu.net>2018-12-12 08:38:17 +0100
committerJon Clausen <jac@nordu.net>2018-12-12 08:38:17 +0100
commit7b512371bbf1e6e9a7c68969f2f0bd971ddde753 (patch)
tree3c14220113e31a95188def34194dbedfb3cc38d4
parent82187d8b869c2e695b6dffd1eef0a912fa53ccd7 (diff)
enclose and quote vars
-rwxr-xr-xcode/vlanscrape-wrapper34
1 files changed, 17 insertions, 17 deletions
diff --git a/code/vlanscrape-wrapper b/code/vlanscrape-wrapper
index 3c5577d..bec76af 100755
--- a/code/vlanscrape-wrapper
+++ b/code/vlanscrape-wrapper
@@ -10,47 +10,47 @@
cd /home/vlanscrape/git/git.nordu.net/vlanscrape-data
TmpFile=$(mktemp)
-if [ -z $TmpFile ]
+if [ -z "${TmpFile}" ]
then
echo "cannot create temp file, giving up on versioning vlanscrape data"
exit 1
fi
-git status --porcelain=1 >$TmpFile
+git status --porcelain=1 >"${TmpFile}"
-FilesAdded=$(grep -E '^??' $TmpFile | wc -l)
-FilesAdded=$(echo $FilesAdded | cut -f 1 -d \ )
-FilesModified=$(grep -E '^ M' $TmpFile | wc -l)
-FilesModified=$(echo $FilesModified | cut -f 1 -d \ )
-Something=$(wc -l $TmpFile)
-Something=$(echo $Something | cut -f 1 -d \ )
+FilesAdded=$(grep -E '^??' "${TmpFile}" | wc -l)
+FilesAdded=$(echo ${FilesAdded} | cut -f 1 -d \ )
+FilesModified=$(grep -E '^ M' "${TmpFile}" | wc -l)
+FilesModified=$(echo ${FilesModified} | cut -f 1 -d \ )
+Something=$(wc -l "${TmpFile}")
+Something=$(echo ${Something} | cut -f 1 -d \ )
-if [ $Something -ne 0 ]
+if [ ${Something} -ne 0 ]
then
- if [ $FilesAdded -ne 0 ]
+ if [ ${FilesAdded} -ne 0 ]
then
CommitMsg="File addition"
fi
- if [ $FilesModified -ne 0 ]
+ if [ ${FilesModified} -ne 0 ]
then
- if [ -z $CommitMsg ]
+ if [ -z "${CommitMsg}" ]
then
CommitMsg="File modification"
else
- CommitMsg="$CommiMsg and modification"
+ CommitMsg="${CommiMsg} and modification"
fi
fi
- if [ -z $CommitMsg ]
+ if [ -z "${CommitMsg}" ]
then
CommitMsg="something changed"
fi
fi
-if [ ! -z $CommitMsg ]
+if [ ! -z "${CommitMsg}" ]
then
git add .
- git commit -m "$CommitMsg"
+ git commit -m "${CommitMsg}"
git push
fi
-rm ${TmpFile}
+rm "${TmpFile}"