sh 通过shell更新主机。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 通过shell更新主机。相关的知识,希望对你有一定的参考价值。

# update hosts
echo "Start update hosts"
echo "Create a new host file"
touch hosts
echo "Done!"
echo "Update AD block hosts ..."
curl https://raw.githubusercontent.com/vokins/yhosts/master/hosts >> hosts
echo "Done!"
echo "Update Google hosts ..."
curl https://raw.githubusercontent.com/sy618/hosts/master/p >> hosts
echo "Done!"
echo "Update Youtube hosts ..."
curl https://raw.githubusercontent.com/sy618/hosts/master/y >> hosts
echo "Done!"
echo "Update FQ hosts ..."
curl https://raw.githubusercontent.com/racaljk/hosts/master/hosts >> hosts
echo "Done!"
echo "Start update your host file, please input your password:"
sudo mv /etc/hosts /etc/hosts_$(date +%Y%m%d)
echo "Current host is backup to /etc/hosts_$(date +%Y%m%d)"
sudo mv hosts /etc/hosts
echo "Host file update completed."

以上是关于sh 通过shell更新主机。的主要内容,如果未能解决你的问题,请参考以下文章

sh [shell]编辑主机文件

利用shell脚本执行ssh远程另一台主机执行命令并返回命令的结果集

sh 将主机添加到known_host shell

怎么在一个shell脚本中执行远程主机的另一个shell脚本?? ssh已经可以无密码登录了。

shell应用4

请问我在Linux下想实现一个终端同时通过SSH执行其它多个终端内的shell脚本怎么实现?