linux脚本中while循环中执行ssh命令后循环只会执行一次

while read ip

do

            echo "$ip"
            ssh root@$ip "touch a.txt"

done </ip.txt

ip.txt文件中存在两个ip
如果执行ssh命令的话echo 只会打印一次,也就是循环只做了一次
,不执行ssh命令的话就会执行两次

https://blog.csdn.net/balternotz/article/details/52931835