From: Michael Tremer Date: Sat, 18 May 2013 12:14:22 +0000 (+0200) Subject: modem: Fix getting provider information. X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fnetwork.git;a=commitdiff_plain;h=c5feadb0c526cd44b0062e15ed737f965e3401b9 modem: Fix getting provider information. If there were spaces in the output string, the string has not been correctly parsed. --- diff --git a/functions.modem b/functions.modem index 8b78478c..1960ee64 100644 --- a/functions.modem +++ b/functions.modem @@ -391,12 +391,30 @@ function __modem_get_network_operator() { assert_check_retval $? output=${output#*: } - - local mode format operator act - read mode format operator act <<< "${output//,/ }" - - # Remove all " from the operator string. - operator=${operator//\"/} + output=${output//,/ } + + local arg mode format operator act + local i=0 + while read -r arg; do + case "${i}" in + 0) + mode="${arg}" + ;; + 1) + format="${arg}" + ;; + 2) + operator="$(strip ${arg})" + ;; + 3) + act="${arg}" + ;; + *) + break + ;; + esac + i="$(( ${i} + 1 ))" + done <<< "$(args ${output})" print "${!argument}" return ${EXIT_OK}