From: Andre Noll Date: Sun, 10 Oct 2010 09:12:51 +0000 (+0200) Subject: gsu: com_prefs -e fixes. X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=commitdiff_plain;h=859161e1efa39afbb8368c8cf64f9d310aae69e7 gsu: com_prefs -e fixes. Create the subdirectory for the config file if it does not exist, and fix the return value for the editor command. --- diff --git a/funcs/gsu b/funcs/gsu index b873ad9..f536717 100644 --- a/funcs/gsu +++ b/funcs/gsu @@ -14,6 +14,7 @@ E_GSU_BAD_BOOL bad value for boolian option E_GSU_BAD_OPTION_TYPE invalid option type E_GSU_BAD_ARG_COUNT invalid number of arguments E_GSU_EDITOR failed to execute editor +E_GSU_MKDIR failed to create directory $gsu_errors " local a b i=0 @@ -179,9 +180,14 @@ _com_prefs() local i conf="${gsu_config_file:=$HOME/.$gsu_name.rc}" if [[ "$1" = "-e" ]]; then + ret=-$E_GSU_MKDIR + result="${conf%/*}" + mkdir -p "$result" + [[ $? -ne 0 ]] && return ret=-$E_GSU_EDITOR result="${EDITOR:-vi}" "$result" "$conf" + [[ $? -ne 0 ]] && return ret=$GSU_SUCCESS return fi