It's a simple question of best pratices: Which should I use?
Option 1
ping -c1 "$host"
if [[ $? -eq 0 ]] ; then
command
else
command
fi
Option 2
if ping -c1 "$host" ; then
command
else
command
fi
I know this is a simple command, but if it grows big, the difference might be significant.