From c2d03a6157867608fe2daef1c8bbfc3d727c0d72 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 9 Oct 2011 18:52:03 +0200 Subject: [PATCH] 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. --- misc/gsu/subcommand | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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" -- 2.39.2