joukewitteveen/netcfg — comment on commit 10a01a13d3e849e576dadd5ca39be67c632f9f3a
File: scripts/wifi-menu line 203
By falconindy:

Oh. If your only goal is to check if the interface has a carrier, then this is all wrong. Just write a utility function that looks at the 'carrier' file in /sys for the device.

interface_has_carrier() {
local status

# read might return EINVAL here -- treat it as "no carrier"
read status <"/sys/class/net/$1/carrier" 2>/dev/null || return 1
return $(( !status ))
}