Shell script to test command line program
I have a program written in C that operates similar to the below output.
WELCOME TO PROGRAM. Hit 1 to do task 1. Hit 2 to do task 2. Hit q to quit.
What i need is a bash shell script that start the program, then enters 1, 2 and q into the program so i can test all the functionality in one command.
I would assume it to look similar to the following
#!/bin/bash ./start kernel 1 2 q
Typically you use expect for testing these types of applications.
You can use a "here document" . The syntax looks like this:
./start kernel <<EOF 1 2 q EOF
"EOF" can be whatever unique word you want, as long as it isn't something you'll actually need in the input.