diff --git a/lib/cli.sh b/lib/cli.sh index 31e653c..ff0ed72 100644 --- a/lib/cli.sh +++ b/lib/cli.sh @@ -41,12 +41,21 @@ parse_ws() { } parse_word() { - local arg line=$1 + local arg line=$1 instr=0 while (( ${#line} )); do local next=${line:0:1} - if [[ $next != [[:space:]] ]]; then + if ! (( instr )) && [[ $next = \" ]]; then + instr=1 + line=${line:1} + elif (( instr )) && [[ $next = \" ]]; then + instr=0 + line=${line:1} + elif (( instr )); then + arg+=$next + line=${line:1} + elif [[ $next != [[:space:]] ]]; then arg+=$next line=${line:1} else