在脚本中使用sudo命令,将密码保存在脚本中,不需要手动输入密码

在脚本中使用sudo命令,将密码保存在脚本中,不需要手动输入密码。

 

#!/bin/bash

echo 'xxx密码xxx'|sudo -S service mysql start

echo 'xxx密码xxx'|sudo -S reboot

 

posted @ 2016-08-18 10:48  Hello_2018  阅读(641)  评论(0编辑  收藏  举报