From: Andre Noll Date: Sun, 9 Oct 2011 16:52:03 +0000 (+0200) Subject: gsu subcommand: Use gsu_getopts. X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=commitdiff_plain;h=c2d03a6157867608fe2daef1c8bbfc3d727c0d72 gsu subcommand: Use gsu_getopts. This makes the prefs command error out on invalid options and avoids the expansion of the possibly unset parameter $1. --- diff --git a/misc/gsu/subcommand b/misc/gsu/subcommand index 7e706d8..911179e 100644 --- a/misc/gsu/subcommand +++ b/misc/gsu/subcommand @@ -92,7 +92,13 @@ _com_prefs() { local i conf="${gsu_config_file:=$HOME/.$gsu_name.rc}" - if [[ "$1" = "-e" ]]; then + gsu_getopts "e" + eval "$result" + (($ret < 0)) && return + gsu_check_arg_count $# 0 0 + (($ret < 0)) && return + + if [[ "$o_e" == "true" ]]; then ret=-$E_GSU_MKDIR result="${conf%/*}" mkdir -p "$result"