#!/bin/bash COMMAND=$(curl -I -s -m 3 www.baidu.com |grep HTTP|awk '{print $2}') for ((;;)) do sleep 1 if [ $COMMAND -eq 302] then echo "11" break && exit else echo "$COMMAND" fi done
#!/bin/bash while true do COMMAND=$(curl -I -s -m 3 www.baidu.com |grep HTTP|awk '{print $2}') sleep 1 if [ $COMMAND -eq 302 ] then echo "$COMMAND" break && exit else echo "$COMMAND" fi done