From: Andre Noll <maan@tuebingen.mpg.de>
Date: Sat, 7 Oct 2017 13:02:43 +0000 (+0200)
Subject: Add some missing double quotes.
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=8ab2321bcdb1d7f018bdd398c1b7b1a4da5d22e5;p=gsu.git

Add some missing double quotes.

All of these were found by shellcheck. Some are harmless, but let's
fix them anyway.
---

diff --git a/config b/config
index caaf39d..0f8bb59 100644
--- a/config
+++ b/config
@@ -84,6 +84,6 @@ gsu_check_options_or_die()
 
 if [[ "$(type -t _gsu_setup)" != "function" ]]; then
 	gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
-	. $gsu_dir/common || exit 1
+	. "$gsu_dir/common" || exit 1
 	_gsu_setup
 fi
diff --git a/gui b/gui
index 2e8b40f..23e9e90 100644
--- a/gui
+++ b/gui
@@ -4,7 +4,7 @@
 
 if [[ "$(type -t _gsu_setup)" != "function" ]]; then
 	gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
-	. $gsu_dir/common || exit 1
+	. "$gsu_dir/common" || exit 1
 	_gsu_setup
 fi
 
diff --git a/subcommand b/subcommand
index 34553b8..b3dc049 100644
--- a/subcommand
+++ b/subcommand
@@ -4,7 +4,7 @@
 
 if [[ "$(type -t _gsu_setup)" != "function" ]]; then
 	gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
-	. $gsu_dir/common || exit 1
+	. "$gsu_dir/common" || exit 1
 	_gsu_setup
 fi
 
@@ -46,7 +46,7 @@ _gsu_available_commands()
 
 			# otherwise delete it
 			d
-		' $0
+		' "$0"
 	} | sort | tr '\n' ' ')"
 }
 
@@ -300,7 +300,7 @@ com_man()
 	echo "${equal_signs:0:${#gsu_name} + ${#gsu_banner_txt} + 16}"
 	echo
 
-	sed -e '1,/^#\{70,\}/d' -e '/^#\{70,\}/,$d' $0 -e 's/^# *//'
+	sed -e '1,/^#\{70,\}/d' -e '/^#\{70,\}/,$d' "$0" -e 's/^# *//'
 	echo "----"
 	echo
 	echo "$gsu_name usage"
@@ -320,7 +320,7 @@ com_man()
 		echo "${minus_signs:0:$num}"
 		echo "$com"
 		echo "${minus_signs:0:$num}"
-		$0 help $com
+		"$0" help "$com"
 		echo
 	done
 	} | $pager
@@ -414,7 +414,7 @@ com_help()
 	ret=$GSU_SUCCESS
 	_gsu_get_command_regex "$1"
 	ere="$result"
-	if ! grep -Eq "$ere" $0; then
+	if ! grep -Eq "$ere" "$0"; then
 		_gsu_print_available_commands
 		result="$1"
 		ret=-$E_GSU_BAD_COMMAND
@@ -437,7 +437,7 @@ com_help()
 			:p
 			p
 		}
-	' $0
+	' "$0"
 }
 
 complete_help()
@@ -476,8 +476,8 @@ EOF
 	words=("$@")
 	cmd="${words[1]}"
 	ret=$GSU_SUCCESS # It's not an error if no completer was defined
-	[[ "$(type -t complete_$cmd)" != "function" ]] && return
-	complete_$cmd "$cword" "${words[@]}"
+	[[ "$(type -t "complete_$cmd")" != "function" ]] && return
+	"complete_$cmd" "$cword" "${words[@]}"
 	# ignore errors, they would only clutter the completion output
 	ret=$GSU_SUCCESS
 }
@@ -584,8 +584,8 @@ gsu()
 	fi
 	arg="$1"
 	shift
-	if [[ "$(type -t com_$arg)" == 'function' ]]; then
-		com_$arg "$@"
+	if [[ "$(type -t "com_$arg")" == 'function' ]]; then
+		"com_$arg" "$@"
 		if (("$ret" < 0)); then
 			gsu_err_msg
 			exit 1