在笔记本上回答是/否外壳提示 [英] Answering Yes/No shell prompt on notebook
问题描述
我正在运行 shell执行命令在笔记本(Google合作实验室)中,这样的命令提示我给出是/否答案.如何在笔记本中响应此提示外壳消息?
I'm running a shell execute command in a notebook (Google Collaboratory), and such command prompts me to give a yes/no answer. How can I respond to this prompt shell message within the notebook?
推荐答案
更新:Colab现在支持输入提示,因此您应该立即看到这些提示,例如
Update: Colab now supports input prompts, so you should see these immediately, e.g.,
旧答案::典型的模式是在没有提示的情况下运行命令(如果有这样的选项).例如,对于使用apt
进行安装,请提供选项-y
.
Old answer: A typical pattern is to run the command without prompts, if it has such an option. For example, for installation using apt
, provide the option -y
.
如果不存在这样的选项,则可以对管道执行类似的操作,例如:yes | programThatHasConfirmationPrompts
.
If no such option exists, you can do something like piping yes to the program like so: yes | programThatHasConfirmationPrompts
.
这篇关于在笔记本上回答是/否外壳提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!