i'm new at bash scripting and i am trying to write a script to check if an ethernet device is up and if so exit the script. That doesn't work as intended, maybe someone can give me a hint.
I start the script, then plug in my device and the script just seems to hang up in the terminal. It is not getting back to the command line.
When the device is plugged in already and the ethernet dev is up the script just runs perfectly. It then echoes 'Connected' and throws me back to command line.
#! /bin/sh
t1=$(ifconfig | grep -o enxca1aea4347b1)
t2='enxca1aea4347b1'
while [ "$t1" != "$t2" ];
do
sleep 1;
done
echo "Connected"
exit 0
grepto decide if the loop should exit