shell脚本内sudo无需输入密码

shell脚本内sudo无需输入密码
echo "password" | sudo -S sh -c "cat hosts.patch >> /etc/hosts"
原理:管道




posted @ 2017-02-13 16:43  陈溜溜  阅读(5702)  评论(0编辑  收藏  举报