传递参数给交互式程序交互的非 [英] passing arguments to an interactive program non interactively

查看:131
本文介绍了传递参数给交互式程序交互的非的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个采用了命令来读取参数交互命令,例如选择Yes / No bash脚本。有没有一种方法来调用这个脚本在非交互式脚本传递默认选项值作为参数?

I have a bash script that employs the read command to read arguments to commands interactively, for example yes/no options. Is there a way to call this script in a non-interactive script passing default option values as arguments?

这不只是一个选项,我要传递给交互脚本。

It's not just one option that I have to pass to the interactive script.

推荐答案

有关更复杂的任务有期望 http://en.wikipedia.org/wiki/Expect )。
它基本上模拟了一个用户,您可以code脚本如何具体计划产出和相关的东西做出反应。

For more complex tasks there is expect ( http://en.wikipedia.org/wiki/Expect ). It basically simulates a user, you can code a script how to react to specific program outputs and related stuff.

这也适用于情况下,像 SSH 禁止管道密码吧。

This also works in cases like ssh that prohibits piping passwords to it.

这篇关于传递参数给交互式程序交互的非的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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