sed -e 's/,$//' -e 'y/,/:/' myips.txt | xargs -P 5 -I XX curl -skd --connect-timeout 10 --max-time 10 http://XX/
myips。txt将是
127.0.0.1
127.0.0.2
127.0.0.3
我将输出保存在一个文件中,但我不知道如何在每个输出
的开头回显ip命令是curl -skd——connect-timeout 10——max-time 10 http://127.0.0.1然后输出一个随机的网页
考虑到我有超过50个IP要查看,我不知道哪个IP输出什么
例如输出将是
`Error 404: Not Found Error 404: Not Found `
,我希望它是
127.0.0.1 Error 404: Not Found 127.0.0.2 Error 404: Not Found
或者更好的
127.0.0.1 Error 404: Not Found
===================================
127.0.0.2 Error 404: Not Found
sed -e 's/,$//' -e 'y/,/:/' myips.txt
| xargs -P 5 -I XX
sh -c '
printf "%s " XX;
curl -skd --connect-timeout 10 --max-time 10 http://XX/
echo ===================================
'
这实际上与curl无关,下面是echo
的演示:
sed -e 's/,$//' -e 'y/,/:/' myips.txt
| xargs -P 5 -I XX
sh -c '
printf "%s " XX;
echo "Error 404: Not Found";
echo ===================================
'
myips.txt
的输出:
127.0.0.1 Error 404: Not Found
===================================
127.0.0.2 Error 404: Not Found
===================================
127.0.0.3 Error 404: Not Found
===================================