diff --git a/bash_completion b/bash_completion index dc62ec44..59b49082 100644 --- a/bash_completion +++ b/bash_completion @@ -742,8 +742,10 @@ __parse_options() # Take first found long option, or first one (short) if not found. option= - for i in $1; do - case $i in + local -a array + read -a array <<<"$1" + for i in "${array[@]}"; do + case "$i" in ---*) break ;; --?*) option=$i ; break ;; -?*) [[ $option ]] || option=$i ;;