From 1de3634d0c1f0e29e92451ac6c3102daba7016a3 Mon Sep 17 00:00:00 2001 From: earthlng Date: Wed, 21 Nov 2018 15:26:15 +0000 Subject: [PATCH] Update updater.sh - always wrap variables in quotes when dealing with filepaths (for good measure) - don't append when initially creating the temp file (= easier to test the function in a standalone script without having to worry about cleanup) --- updater.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/updater.sh b/updater.sh index 56223da..f05d93c 100755 --- a/updater.sh +++ b/updater.sh @@ -172,8 +172,8 @@ backup_file () { if [ $BACKUP = "single" ]; then bakname="userjs_backups/${filename}.backup" fi - mv $filename $bakname - mv "userjs_temps/${filename}" $filename + mv "$filename" "$bakname" + mv "userjs_temps/${filename}" "$filename" echo -e "Status: ${GREEN}${filename} has been backed up and replaced with the latest version!${NC}" } @@ -305,7 +305,7 @@ update_userjs () { remove_comments () { if [ $MINIFY = "true" ]; then - sed -n 1,8p user.js >> userjs_temps/no_comments.js # Add header + sed -n 1,8p user.js > userjs_temps/no_comments.js # Add header echo "******/" >> userjs_temps/no_comments.js # Add end of comment # Remove comments and empty lines sed -e 's/\s*\/\/ .*$//' -e 's|/\*|\n&|g;s|*/|&\n|g' -e '/\/\*/,/*\//d' -e '/^\s*$/d' -e '/^[[:space:]]*$/d' user.js >> userjs_temps/content.js