简体   繁体   English

自动将输入传递给终端?

[英]Pass input to terminal automatically?

I want to enter "yes" as a input when to "yes/no" automatically prompt on the screen instead of manually, here is the script 我想在屏幕上自动提示而不是手动提示“是/否”时输入“是”作为脚本,这是脚本

ansible-playbook -i hostvnc.ini vnc.yml --user=ubuntu --private-key=rampvnc.pem --extra-vars="dns=ec2-54-205-170-165.compute-1.amazonaws.com"

the dns option that I am passing on is actually generated dynamically. 我传递的dns选项实际上是动态生成的。 During the execution of this script here that very prompt 在执行此脚本期间,非常提示

PLAY [vnc] ******************************************************************** 

GATHERING FACTS *************************************************************** 
The authenticity of host 'ec2-54-205-170-165.compute-1.amazonaws.com (54.205.170.165)' can't be established.
ECDSA key fingerprint is 31:7f:a1:f0:18:73:f1:6d:b9:dc:16:25:4a:4f:40:5f.
Are you sure you want to continue connecting (yes/no)? 

How can I enter "yes" as a input ?, I have tried this option but no success 如何输入“是”作为输入?,我试过此选项但没有成功

ansible-playbook -i hostvnc.ini vnc.yml --user=ubuntu --private-key=rampvnc.pem --extra-vars="dns=ec2-54-205-170-165.compute-1.amazonaws.com" | ansible-playbook -i hostvnc.ini vnc.yml --user = ubuntu --private-key = rampvnc.pem --extra-vars =“ dns = ec2-54-205-170-165.compute-1.amazonaws。 com” | echo "yes" 回声“是”

what about yes | your_command yes | your_command什么? yes | your_command . yes | your_command

or better yet add this line to your ~/.ssh/config 或者更好的是将此行添加到您的〜/ .ssh / config

StrictHostKeyChecking no

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM