aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2020-08-12 16:05:06 +0200
committerOlav Vitters <olav@vitters.nl>2020-08-12 16:05:06 +0200
commit3e6ac604337d5a0843e131dd72d8b4494d1b883c (patch)
tree74338786370a7a7506a6fe376fbcb264a6b5639c
parent9848c7c2e6cce9eb12cbad423df814b0cb6829c5 (diff)
downloadinitscripts-3e6ac604337d5a0843e131dd72d8b4494d1b883c.tar
initscripts-3e6ac604337d5a0843e131dd72d8b4494d1b883c.tar.gz
initscripts-3e6ac604337d5a0843e131dd72d8b4494d1b883c.tar.bz2
initscripts-3e6ac604337d5a0843e131dd72d8b4494d1b883c.tar.xz
initscripts-3e6ac604337d5a0843e131dd72d8b4494d1b883c.zip
ifdown-hso: shellcheck: fix most shell quoting issues
-rwxr-xr-xmageia/network-scripts/ifdown-hso22
1 files changed, 11 insertions, 11 deletions
diff --git a/mageia/network-scripts/ifdown-hso b/mageia/network-scripts/ifdown-hso
index 0cedb00e..a920c17c 100755
--- a/mageia/network-scripts/ifdown-hso
+++ b/mageia/network-scripts/ifdown-hso
@@ -12,8 +12,8 @@ source_config
[ -z "$CELLULAR_CID" ] && CELLULAR_CID=1
[ "${DEBUG}" = "yes" ] && CHATDBG="-v"
-CHATSCRIPT=`mktemp /tmp/chatXXXXXX`
-cat > $CHATSCRIPT <<EOF
+CHATSCRIPT=$(mktemp /tmp/chatXXXXXX)
+cat > "$CHATSCRIPT" <<EOF
ABORT ERROR
TIMEOUT 5
"" ATZ
@@ -21,35 +21,35 @@ OK "AT_OWANCALL=${CELLULAR_CID},0,0"
OK ""
EOF
-if ! /usr/sbin/chat ${CHATDBG} -s -f ${CHATSCRIPT} < $MODEMPORT > $MODEMPORT; then
+if ! /usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"; then
echo $"Disconnect script failed (HSO)"
fi
# ask status (it also waits for device state to be cleaner)
# do not fail if status querying fail
-cat > $CHATSCRIPT <<EOF
+cat > "$CHATSCRIPT" <<EOF
ABORT ERROR
TIMEOUT 2
"" ATZ
OK "AT_OWANDATA=${CELLULAR_CID}"
EOF
-/usr/sbin/chat ${CHATDBG} -s -f ${CHATSCRIPT} < $MODEMPORT > $MODEMPORT
+/usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"
-rm -f $CHATSCRIPT
+rm -f "$CHATSCRIPT"
-ip addr flush dev ${DEVICE} 2>/dev/null
-ip link set dev ${DEVICE} down 2>/dev/null
+ip addr flush dev "${DEVICE}" 2>/dev/null
+ip link set dev "${DEVICE}" down 2>/dev/null
retcode=$?
# wait up to 5 seconds for device to actually come down...
waited=0
-while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do
+while ! check_device_down "${DEVICE}" && [ "$waited" -lt 50 ] ; do
usleep 10000
- waited=$(($waited+1))
+ (( waited++ ))
done
if [ "$retcode" = 0 ] ; then
- /etc/sysconfig/network-scripts/ifdown-post $CONFIG
+ /etc/sysconfig/network-scripts/ifdown-post "$CONFIG"
# do NOT use $? because ifdown should return whether or not
# the interface went down.
fi