X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=subcommand;fp=subcommand;h=b3dc0493905a2eb0a0bcb016bc99ed8e4799d981;hb=8ab2321bcdb1d7f018bdd398c1b7b1a4da5d22e5;hp=34553b808970e92ae29f5f2dbce060c1cc2f6ae7;hpb=7118adb657e4baaa35515622057fc79a60788992;p=gsu.git 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