如何执行自动Unix输入? [英] how to perform automated Unix input?

查看:44
本文介绍了如何执行自动Unix输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置要代替标准输入使用的字符串?例如,在Unix中运行latex命令时,总会发现一些小错误,要跳过所有错误,您必须在命令行中输入"r"(我现在知道,特别是对于Latex,可以使用-interactionmode nonstopmode,但是有更通用的解决方案吗?)无论如何,有没有指定自动执行此操作?我尝试将标准输入重定向为从包含"r \ n"的文件中读取,但这没有用.我该如何实现?

How can you set a string to be used instead of standard input? For example, when running the latex command in Unix it will always find some trivial errors, to skip through all errors you have to enter "r" into the command line (I now know that with latex specifically you can use -interactionmode nonstopmode, but is there a more general solution to do this?) Is there anyway to specify that this should be done automatically? I tried redirecting standard input to read from a file containing "r\n", but this didn't work. How can I achieve this?

推荐答案

并非所有需要输入的应用程序都能满足其 stdin 重定向.

Not all applications that need input can be satisfied with their stdin redirected.

这是因为该应用程序可以调用isatty C函数(如果用C编写,或者使用其他语言的等效调用)来确定输入是否来自tty.

This is because the app can call the isatty C function (if written in C, or some equivalent call for other languages) to determine if the input come from a tty or not.

在这种情况下,有一个有价值的工具可以使用,这就是期望.

In such situation, there is a valuable tool to use, and this is expect.

这篇关于如何执行自动Unix输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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