Check wget’s return value
Others have correctly posted that you can use $? to get the most recent exit code: wget_output=$(wget -q “$URL”) if [ $? -ne 0 ]; then … This lets you capture both the stdout and the exit code. If you don’t actually care what it prints, you can just test it directly: if wget -q … Read more