在bash Ubuntu Linux操作系统脚本程序输入 [英] Script program inputs in bash ubuntu linux
问题描述
我在C ++程序设计课程。
I'm in a course for C++ programming.
我们的教授创建一个Linux验证脚本对抗,我们的节目输出必须完全匹配。
Our professor created a linux validation script against which our program output must match exactly.
它的运行出了自己的方案,并生成一个output.txt的文件,然后进行比较,对他的输出文件,如果不匹配就拒绝脚本。
It's running out of his own program and generates an output.txt file, then compares it against his output file, if it doesn't match it rejects the script.
问题是,这种方案可能节选150-200输入线和如果有什么错在你不得不从头再来。如果即使输入一个不正确字符,则必须重新启动作为退格寄存器作为其自身的一个字符。
The problem is, this program excepts probably 150-200 lines of input and if anything goes in wrong you have to start all over again. If you even enter an incorrect char, it must be restarted as the backspace registers as a character of its own.
我如何可能会产生一个bash脚本,将养活所有输入到程序自动?
How might I generate a bash script that would feed all of the input into the program automatically?
请注意:我们不得不使用他的计划中:〜professor.name /提交asigname
NOTE: We have to use his program as in: ~professor.name/submit asigname
推荐答案
您可以创建一个文本文件:
You can create a text file:
的 answers.txt 的
answer1
answer2
...
answerN
和使用,作为标准输入程序:
and use that as stdin for the program:
./your_program < answers.txt
这篇关于在bash Ubuntu Linux操作系统脚本程序输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!