问题:
sudo: a terminal is required to read the password; either use the -S option to read from standard in or configure an askpass helper
原因:
具有sudo权限的用户执行shell 脚本时,脚本中使用的sudo命令需要输入密码
解决方法:
编辑文件/etc/sudoers, 配置此sudo权限用户(例如:sudoaccount)使用sudo命令时不需要输入密码
sudoaccount@mydesktop:~$ sudo visudo
在文件末尾添加
sudoaccount ALL=(ALL:ALL) NOPASSWD: ALL
:wq保存编辑,退出