问题描述
我有一个小的.sh脚本,如下所示(忽略/ dev / null,这是我正在使用的hack;
#!/bin/bash
while read host port; do
echo `timeout 5 telnet $host $port </dev/null 2>&1 > /dev/null` >> sample_output.txt
done < ip_port.txt
host_ip1 port1
host_ip2 port2
当我在终端上运行命令时,我在sample_output.txt上得到的正确输出为“外部主机关闭连接”
echo `timeout 5 telnet $host $port </dev/null 2>&1 > /dev/null` >> sample_output.txt
但是当我执行.sh时,文件sample_output.txt为空白。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)