qmi-network: Fix grabbing output from lines with spaces
The qmi-network script used awk with a field separator of ":". The output looked like key: 'value'. The second field in this case includes a space at the beginning. This was making the 'status' command fail. Now, we account for the space. It is now also not dependent on awk (this can matter on embedded systems).
This commit is contained in:
parent
70b0d9fd9e
commit
d106b89b7b
|
@ -119,7 +119,7 @@ start_network ()
|
|||
|
||||
# Save the new CID if we didn't use any before
|
||||
if [ "x$CID" = "x" ]; then
|
||||
CID=`echo "$START_NETWORK_OUT" | grep CID | sed "s/'//g" | awk 'BEGIN { FS = ":" } ; { print $2 }'`
|
||||
CID=`echo "$START_NETWORK_OUT" | sed -n "s/.*CID.*'\(.*\)'.*/\1/p"`
|
||||
if [ "x$CID" = "x" ]; then
|
||||
echo "error: network start failed, client not allocated" 1>&2
|
||||
exit 1
|
||||
|
@ -128,7 +128,7 @@ start_network ()
|
|||
fi
|
||||
fi
|
||||
|
||||
PDH=`echo "$START_NETWORK_OUT" | grep handle | sed "s/'//g" | awk 'BEGIN { FS = ":" } ; { print $2 }'`
|
||||
PDH=`echo "$START_NETWORK_OUT" | sed -n "s/.*handle.*'\(.*\)'.*/\1/p"`
|
||||
if [ "x$PDH" = "x" ]; then
|
||||
echo "error: network start failed, no packet data handle" 1>&2
|
||||
# Cleanup the client
|
||||
|
@ -187,7 +187,7 @@ packet_service_status ()
|
|||
STATUS_OUT=`$STATUS_CMD`
|
||||
fi
|
||||
|
||||
CONN=`echo "$STATUS_OUT" | grep "Connection status" | sed "s/'//g" | awk 'BEGIN { FS = ":" } ; { print $2 }'`
|
||||
CONN=`echo "$STATUS_OUT" | sed -n "s/.*Connection status:.*'\(.*\)'.*/\1/p"`
|
||||
if [ "x$CONN" = "x" ]; then
|
||||
echo "error: couldn't get packet service status" 1>&2
|
||||
exit 2
|
||||
|
|
Loading…
Reference in New Issue