IP放到数组中,循环执行:
ssh $username@$ip "sed -i 's/192.168.0.110 code.test.com/192.168.0.117 code.test.com/g' /etc/hosts"
博客介绍将IP放入数组并循环执行操作,通过ssh连接远程主机,使用sed命令批量修改远程主机/etc/hosts文件中的IP映射,将192.168.0.110 code.test.com替换为192.168.0.117 code.test.com。
IP放到数组中,循环执行:
ssh $username@$ip "sed -i 's/192.168.0.110 code.test.com/192.168.0.117 code.test.com/g' /etc/hosts"

被折叠的 条评论
为什么被折叠?