判断端口是否打开时间:2023-02-06 15:20:46 while true do nc -vz 127.0.0.1 1234 rs=$? echo $rs if [ $rs -gt 0 ] then echo "1" ls else echo "0" ls -l fi sleep 2 done