aboutsummaryrefslogtreecommitdiff
path: root/net/ifconfig.sh.Linux.in
diff options
context:
space:
mode:
Diffstat (limited to 'net/ifconfig.sh.Linux.in')
-rw-r--r--net/ifconfig.sh.Linux.in26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in
index a5540c03..dcbd6286 100644
--- a/net/ifconfig.sh.Linux.in
+++ b/net/ifconfig.sh.Linux.in
@@ -26,7 +26,7 @@ _ifindex()
{
local line= i=-2
while read line; do
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -lt 1 ] && continue
case "${line}" in
"${IFACE}:"*) echo "${i}"; return 0;;
@@ -34,7 +34,7 @@ _ifindex()
done < /proc/net/dev
# Return the next available index
- i=$((${i} + 1))
+ : $(( i += 1 ))
echo "${i}"
return 1
}
@@ -96,7 +96,7 @@ _get_inet_addresses()
_exists || break
local addr="$(_get_inet_address)"
[ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
echo "${addrs}"
}
@@ -106,26 +106,26 @@ _cidr2netmask()
local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
local octets= frac=
- local octets=$((${cidr} / 8))
- local frac=$((${cidr} % 8))
+ local octets=$(( cidr / 8 ))
+ local frac=$(( cidr % 8 ))
while [ ${octets} -gt 0 ]; do
netmask="${netmask}.255"
- octets=$((${octets} - 1))
- done=$((${done} + 1))
+ : $(( octets -= 1 ))
+ : $(( done += 1 ))
done
if [ ${done} -lt 4 ]; then
while [ ${i} -lt ${frac} ]; do
- sum=$((${sum} + ${cur}))
- cur=$((${cur} / 2))
- i=$((${i} + 1))
+ : $(( sum += cur ))
+ : $(( cur /= 2 ))
+ : $(( i += 1 ))
done
netmask="${netmask}.${sum}"
- done=$((${done} + 1))
+ : $(( done += 1 ))
while [ ${done} -lt 4 ]; do
netmask="${netmask}.0"
- done=$((${done} + 1))
+ : $(( done += 1 ))
done
fi
@@ -150,7 +150,7 @@ _add_address()
# Get the last alias made for the interface and add 1 to it
i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
| sed -n -e 's/'"${iface}"'://p')
- i=$((${i:-0} + 1))
+ : $(( i = ${i:-0} + 1 ))
iface="${iface}:${i}"
fi