Shell script to test command line program

I have a program written in C that operates similar to the below output.


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


./start kernel 


Typically you use expect for testing these types of applications.

You can use a "here document" . The syntax looks like this:

./start kernel <<EOF

"EOF" can be whatever unique word you want, as long as it isn't something you'll actually need in the input.

Need Your Help

Can devs view bugs created in MS Test Manager without using test manager?

tfs qa microsoft-test-manager

I want to start using MS Test Manager over our current test case management software for a number of reasons. I like that you can create bugs right from the test case which I thought was a great id...

How to use SVN folder / files normally just to trace it without committing / rollback effects on it

php svn

I have got one folder from someone with SVN and I have to look into this (I want to trace it with changes in code but for temporaty only and dont want to save any of the changes done by me) on my l...