传递参数给交互式程序交互的非

编程入门 行业动态 更新时间:2024-10-28 21:26:26
本文介绍了传递参数给交互式程序交互的非的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个采用了读命令来读取参数交互命令,例如选择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.

推荐答案

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

For more complex tasks there is expect ( en.wikipedia/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.

更多推荐

传递参数给交互式程序交互的非

本文发布于:2023-06-07 13:24:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/560839.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!