小编PRA*_*WAL的帖子

执行bash脚本时等待输入

我见过这个问题: Pause execution and wait for user input,但我的问题是不同的。

我有一个命令:

google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless --client-secrets src/.config/client_secret_71131800372-dop7miagipbqink2ecnr33so61q3li0t.apps.googleusercontent.com.json
Run Code Online (Sandbox Code Playgroud)

此命令提供一个链接,我们在该链接上获得授权代码。此命令等待,直到我们键入授权码上端子和键入后授权码,进一步的处理发生。

该命令的输出如下:

Please visit this URL to authorize this application: 

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=71131800372-dop7miagipbqink2ecnr33so61q3li0t.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&state=jFHZmMINesXNFbPNR6ZeJcuDVzpmYq&prompt=consent&access_type=offline
Enter the authorization code:
Run Code Online (Sandbox Code Playgroud)

现在,如果我在bash脚本调用写这个命令script.sh和执行该脚本,然后它不等待用户输入授权码和进一步的处理情况。

如果在bash 脚本中执行,我希望它应该等待授权代码

我该怎么做??

bash scripts input

4
推荐指数
1
解决办法
6588
查看次数

标签 统计

bash ×1

input ×1

scripts ×1