解决方式在如下链接中:
echo <password> | sudo -S <cmd>
解决方法用了一句话,详细解释看如下链接:
https://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error.