Fix shellcheck warnings
authora1346054 <36859588+a1346054@users.noreply.github.com>
Fri, 22 Oct 2021 18:39:34 +0000 (18:39 +0000)
committerColin Clark <colin.clark@cclark.uk>
Mon, 1 Nov 2021 10:38:15 +0000 (10:38 +0000)
doc/create-doxygen-lua-api.sh
scripts/keyword_merge.sh
scripts/template-desktop.sh

index b32fabf..c43d6ab 100755 (executable)
@@ -93,9 +93,8 @@ BEGIN {
                {print}
                }
 }
-' ../doxygen.conf > $TMPFILE
+' ../doxygen.conf > "$TMPFILE"
 
-doxygen $TMPFILE
-
-rm $TMPFILE
+doxygen "$TMPFILE"
 
+rm "$TMPFILE"
index 35b8093..1f504c6 100755 (executable)
@@ -10,7 +10,7 @@
 merge_file()
 {
 flag=0
-while read line_merge
+while read -r line_merge
 do
        if [[ flag -eq 0 ]]
        then
@@ -23,7 +23,7 @@ do
                then
                        flag=0
                else
-                       echo $line_merge >> "$2"
+                       echo "$line_merge" >> "$2"
                fi
        fi
 done < "$1"
@@ -65,11 +65,11 @@ fi
 
 tmp_file=$(mktemp)
 
-while read line_main
+while read -r line_main
 do
        if [[ $line_main =~ "</keyword_tree>" ]]
        then
-               merge_file  "$config_merge" "$tmp_file"
+               merge_file "$config_merge" "$tmp_file"
        fi
        echo "$line_main" >> "$tmp_file"
 done < "$config_main"
@@ -77,7 +77,7 @@ done < "$config_main"
 zenity --question --text="Backup configuration file before overwriting?"
 if [[ $? -eq 0 ]]
 then
-       cp "$config_main" "$config_main""."$(date +%Y%m%d%H%M%S)
+       cp "$config_main" "$config_main.$(date +%Y%m%d%H%M%S)"
 fi
 
 mv "$tmp_file" "$config_main"
index c42a279..ee9705c 100755 (executable)
@@ -4,11 +4,11 @@
 # This needs to be run only when the menus have changed.
 
 tmp_file=$(mktemp)
-path=$(dirname $(realpath $0))
-srcpath=$(dirname $path)"/src/layout_util.c"
-templatepath=$(dirname $path)"/plugins/template.desktop.in"
+path=$(dirname "$(realpath "$0")")
+srcpath=$(dirname "$path")/src/layout_util.c
+templatepath=$(dirname "$path")/plugins/template.desktop.in
 
-awk -v src_path=$srcpath 'BEGIN {
+awk -v src_path="$srcpath" 'BEGIN {
 menu_flag = 0
 template_flag = 0
 i = 0
@@ -72,12 +72,12 @@ function get_menus()
 /Valid sections/ {template_flag = 1; print; get_menus()}
 /This is a filter/ {template_flag = 0; print ""}
 (template_flag == 0) {print}
-'  $templatepath > $tmp_file
+'  "$templatepath" > "$tmp_file"
 
-zenity --text-info < $tmp_file
-if [ $? == 0 ]
+zenity --text-info < "$tmp_file"
+if [ "$?" == 0 ]
 then
-       mv $tmp_file  $templatepath
+       mv "$tmp_file" "$templatepath"
 else
-       rm $tmp_file
+       rm "$tmp_file"
 fi