Negate if condition in bash script
You can choose:
if [[ $? -ne 0 ]]; then # -ne: not equal
if ! [[ $? -eq 0 ]]; then # -eq: equal
if [[ ! $? -eq 0 ]]; then
!
inverts the return of the following expression, respectively.
Better
if ! wget -q --spider --tries=10 --timeout=20 google.com
then
echo 'Sorry you are Offline'
exit 1
fi