OSDN Git Service

[fix] : Use array to set parsed arguments
authorhayao <hayao@fascode.net>
Wed, 5 May 2021 13:32:07 +0000 (22:32 +0900)
committerhayao <hayao@fascode.net>
Wed, 5 May 2021 13:32:07 +0000 (22:32 +0900)
dmc

diff --git a/dmc b/dmc
index 90b28a4..0e37548 100755 (executable)
--- a/dmc
+++ b/dmc
@@ -1667,11 +1667,11 @@ REMOVE_FILES=false
 ARGUMENT=("${@}")
 OPTS=("m:" "e:" "h" "G")
 OPTL=("mode:" "editor:" "help" "non-interactive" "noroot" "write-all-files" "no-check-target" "lightdm-greeter" "remove")
-if ! OPT=$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
+if ! readarray -t OPT < <(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
     exit 1
 fi
 
-eval set -- "${OPT}"
+eval set -- "${OPT[@]}"
 unset OPT OPTS OPTL
 
 while true; do