mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Fix values starting by - in getopts
This commit is contained in:
parent
506aaf7472
commit
3a8d312ed2
1 changed files with 2 additions and 0 deletions
|
@ -76,6 +76,8 @@ ynh_handle_getopts_args () {
|
||||||
# ${#arguments[@]} is the size of the array
|
# ${#arguments[@]} is the size of the array
|
||||||
for arg in `seq 0 $(( ${#arguments[@]} - 1 ))`
|
for arg in `seq 0 $(( ${#arguments[@]} - 1 ))`
|
||||||
do
|
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
|
# 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)
|
# (e.g. for [u]=user, --user will be -u)
|
||||||
# Replace long option with =
|
# Replace long option with =
|
||||||
|
|
Loading…
Add table
Reference in a new issue