Rather than answer your stderr
redirection question, I'll suggest a better (IMHO) way:
In https://github.com/waltinator/net-o-matic.git
- Watch for (WiFi) network going down, then do a user-specified thing to fix it.
There's a way to monitor your connection:
ip monitor address | \
egrep --line-buffered \
'^Deleted [[:digit:]]+: [[:alnum:]]+[[:space:]]+inet[[:space:]].* scope global ' | \
while read line ; do
...
My net-o-matic
script also contains a way to ask once:
function netstate () {
# Return network state as "UP" or "DOWN"
#Adjust how you decide net is UP/DOWN
ip link show | egrep -q 'UP,LOWER_UP.* state UP'
if [[ $? -eq 0 ]] ; then
echo "UP"
else
echo "DOWN"
fi
}
&&
? – danzel Jul 5 at 18:40