]> git.ipfire.org Git - people/stevee/network.git/commitdiff
modem: Fix getting provider information.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 18 May 2013 12:14:22 +0000 (14:14 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 May 2013 09:06:56 +0000 (11:06 +0200)
If there were spaces in the output string, the string has not
been correctly parsed.

functions.modem

index 8b78478cc1be34e524f6269b76cd330d24b31b74..1960ee64c8406bc8232df0a69b61511f8ff6b955 100644 (file)
@@ -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}