I’ve just completed the coding section of simple homework assignment for my C++ class. The second part of the assignment requires us to verify our code’s input validation. (The program takes several different values as inputs from a user and prints those values to a file)
I was hoping that I could use bash script for this. Is there any way to use bash script to run and interact with a program? How can I put the program’s output into a variable (note that program has a series of input requests and outputs).
Thanks
To build on @Travis’ answer, create two files: one holds your inputs (
input.txt) and one holds the expected output (expected_output.txt). Then do the following:If the
diffcommand has any output, there’s a problem.