mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Escape $ in getopts
This commit is contained in:
parent
e24890c2f2
commit
23d7a0005d
1 changed files with 4 additions and 0 deletions
|
@ -152,6 +152,8 @@ ynh_handle_getopts_args () {
|
||||||
fi
|
fi
|
||||||
# Escape double quote to prevent any interpretation during the eval
|
# Escape double quote to prevent any interpretation during the eval
|
||||||
all_args[$i]="${all_args[$i]//\"/\\\"}"
|
all_args[$i]="${all_args[$i]//\"/\\\"}"
|
||||||
|
# Escape $ as well to prevent the string following it to be seen as a variable.
|
||||||
|
all_args[$i]="${all_args[$i]//$/\\\$}"
|
||||||
|
|
||||||
eval ${option_var}+=\"${all_args[$i]}\"
|
eval ${option_var}+=\"${all_args[$i]}\"
|
||||||
shift_value=$(( shift_value + 1 ))
|
shift_value=$(( shift_value + 1 ))
|
||||||
|
@ -193,6 +195,8 @@ ynh_handle_getopts_args () {
|
||||||
|
|
||||||
# Escape double quote to prevent any interpretation during the eval
|
# Escape double quote to prevent any interpretation during the eval
|
||||||
arguments[$i]="${arguments[$i]//\"/\\\"}"
|
arguments[$i]="${arguments[$i]//\"/\\\"}"
|
||||||
|
# Escape $ as well to prevent the string following it to be seen as a variable.
|
||||||
|
all_args[$i]="${all_args[$i]//$/\\\$}"
|
||||||
|
|
||||||
# Store each value given as argument in the corresponding variable
|
# Store each value given as argument in the corresponding variable
|
||||||
# The values will be stored in the same order than $args_array
|
# The values will be stored in the same order than $args_array
|
||||||
|
|
Loading…
Add table
Reference in a new issue