我正在运行Ubuntu 18.04
,bash
我想将密码传递给运行的命令sudo
,但是一旦运行,即密码通过管道传输到命令(python3
运行命令app
),它会要求输入密码两次,我正在尝试通过以下方式做到这一点:
echo "passphrase" | echo "passphrase" | echo $password | sudo command
但它似乎不起作用。
该命令的输出如下:
sudo python3 app.py
Enter PEM pass phrase:
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Running on https://127.0.0.1:443/ (Press CTRL+C to quit)
* Restarting with stat
Enter PEM pass phrase:
* Debugger is active!
* Debugger PIN: 157-564-730
127.0.0.1 - - [30/Jan/2019 18:29:44] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/style.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/css/simple-sidebar.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/jquery/jquery.min.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /static/vendor/bootstrap/js/bootstrap.bundle.min.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jan/2019 18:29:45] "GET /favicon.ico HTTP/1.1" 404 -
有谁知道如何通过unix
bash 脚本中的命令来执行此操作?