Make init/functions suitable for running with 'set -u'
Initialize local variables.
This commit is contained in:
parent
6aa2b89fba
commit
8a3cd3db1d
@ -118,7 +118,7 @@ umount_retry() {
|
|||||||
|
|
||||||
get_mac_from_iface() {
|
get_mac_from_iface() {
|
||||||
local iface="$1"
|
local iface="$1"
|
||||||
local mac
|
local mac=
|
||||||
if [ "x$iface" != "x" ] && [ -e "/sys/class/net/$iface" ]; then
|
if [ "x$iface" != "x" ] && [ -e "/sys/class/net/$iface" ]; then
|
||||||
mac="$(cat "/sys/class/net/$iface/address")"
|
mac="$(cat "/sys/class/net/$iface/address")"
|
||||||
fi
|
fi
|
||||||
@ -127,7 +127,7 @@ get_mac_from_iface() {
|
|||||||
|
|
||||||
get_iface_from_mac() {
|
get_iface_from_mac() {
|
||||||
local mac="$1"
|
local mac="$1"
|
||||||
local iface
|
local iface=
|
||||||
if [ "x$mac" != "x" ]; then
|
if [ "x$mac" != "x" ]; then
|
||||||
iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
|
iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user