unless ( fork() ){ #fork and execute, not waiting for a return exec("wget -T 10 -O out.txt $somesite ;if [ $? -ne 0 ]; then cp bad.txt out.txt ;fi"); }