From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Fri, 22 Oct 2021 18:39:34 +0000 (+0000) Subject: Fix shellcheck warnings X-Git-Tag: v1.7~31 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=1e46ade6cc54d36ceabc1d209becdcbff1bc9beb Fix shellcheck warnings --- diff --git a/doc/create-doxygen-lua-api.sh b/doc/create-doxygen-lua-api.sh index b32fabff..c43d6abb 100755 --- a/doc/create-doxygen-lua-api.sh +++ b/doc/create-doxygen-lua-api.sh @@ -93,9 +93,8 @@ BEGIN { {print} } } -' ../doxygen.conf > $TMPFILE +' ../doxygen.conf > "$TMPFILE" -doxygen $TMPFILE - -rm $TMPFILE +doxygen "$TMPFILE" +rm "$TMPFILE" diff --git a/scripts/keyword_merge.sh b/scripts/keyword_merge.sh index 35b80933..1f504c68 100755 --- a/scripts/keyword_merge.sh +++ b/scripts/keyword_merge.sh @@ -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 =~ "" ]] 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" diff --git a/scripts/template-desktop.sh b/scripts/template-desktop.sh index c42a2794..ee9705c2 100755 --- a/scripts/template-desktop.sh +++ b/scripts/template-desktop.sh @@ -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