有bash脚本答案交互式提示 [英] Have bash script answer interactive prompts

查看:118
本文介绍了有bash脚本答案交互式提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能有一个bash脚本自动处理的提示,通常会是psented与默认操作用户$ P $?目前我使用bash脚本调用一个内部工具,将显示提示用户(提示Y / N)来完成的动作,但我写的需要剧本是完全放手,所以我需要一种方法来发送 Y | N 来提示允许程序继续执行。这可能吗?

Is it possible to have a bash script automatically handle prompts that would normally be presented to the user with default actions? Currently I am using a bash script to call an in-house tool that will display prompts to the user (prompting for Y/N) to complete actions, however the script I'm writing needs to be completely "hands-off", so I need a way to send Y|N to the prompt to allow the program to continue execution. Is this possible?

推荐答案

这是不是自动完成,这是自动化。这些东西一个常见的​​工具被称为期待

This is not "auto-completion", this is automation. One common tool for these things is called Expect.

您也可以从

You might also get away with just piping input from yes.

这篇关于有bash脚本答案交互式提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆