打开.bash_profile在.bash_profile中利用管道输入密码 echo “{your_passward}” | sudo -S cmd 参考文章: https://blog.csdn.net/xushx_bigbear/article/details/12966625