I have a command that should open a program after reboot if a specific IP is reachable. I use Debian so sh
is linked to dash
. The code that i execute after system start is:
sh -c "sleep 10 && if ping -c 1 stackoverflow.com &> /dev/null; then gedit; fi"
But with this code gedit will be opened in every case.
If i try in a bash console
sleep 10 && if ping -c 1 stackoverflow.com &> /dev/null; then gedit; fi
then it works correctly. So how can i convert the bash command correctly to dash?