From 3a8d312ed21e8ba5c9811aadec3b0ad12df4d7c3 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 9 Jul 2019 20:06:16 +0200 Subject: [PATCH] [fix] Fix values starting by - in getopts --- data/helpers.d/getopts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/helpers.d/getopts b/data/helpers.d/getopts index b6cd95f3c..3794503ee 100644 --- a/data/helpers.d/getopts +++ b/data/helpers.d/getopts @@ -76,6 +76,8 @@ ynh_handle_getopts_args () { # ${#arguments[@]} is the size of the array for arg in `seq 0 $(( ${#arguments[@]} - 1 ))` do + # Escape options' values starting with -. Otherwise the - will be considered as another option. + arguments[arg]="${arguments[arg]//--${args_array[$option_flag]}-/--${args_array[$option_flag]}\\-}" # And replace long option (value of the option_flag) by the short option, the option_flag itself # (e.g. for [u]=user, --user will be -u) # Replace long option with =