I am trying to execute this command expressvpn connect
in a bash script to be executed in terminal. The problem is that sometimes it takes too long to connect and I want to make sure it doesn't take too much. I tried this command
some_command
if [ $? -eq 0 ]; then
echo OK
else
echo FAIL
fi
but this is for checking wether the command is executed or not, while I want to make sure that if it is not executed in, say 10 seconds, then the script must stop and start over from the beginning. How do I do that? Here's the full code
#!/bin/bash
expressvpn disconnect
while (0<1); do
expressvpn connect smart location
xdg-open http://link
sleep 15
xdotool key Control_L+w
expressvpn disconnect
expressvpn refresh
done
I hope I was clear. Thanks in advance.