I forgot the place, other than here, where this came from.
I made an improvement.
#!/bin/bash
# Help from https://linux.org,
# Define a reliable host to ping
HOST="google.com"
# Number of pings to send
COUNT=1
# Check for internet connectivity using ping
if ping -c "$COUNT" "$HOST" &> /dev/null; then
echo "Internet connection detected. Launching Firefox..."
# Show a visual message on the desktop
gxmessage -fg red -font 'sans 20' -timeout 5 "Starting Firefox."
export DISPLAY=:0.0
firefox
else
echo "No internet connection detected."
fi
I made an improvement.
#!/bin/bash
# Help from https://linux.org,
# Define a reliable host to ping
HOST="google.com"
# Number of pings to send
COUNT=1
# Check for internet connectivity using ping
if ping -c "$COUNT" "$HOST" &> /dev/null; then
echo "Internet connection detected. Launching Firefox..."
# Show a visual message on the desktop
gxmessage -fg red -font 'sans 20' -timeout 5 "Starting Firefox."
export DISPLAY=:0.0
firefox
else
echo "No internet connection detected."
fi

