I have a bash script where I am running a c program using here documents because the c program expects inputs from the user.

so i have something like this

#!/bin/bash
./runnable inputfile.txt <<_END_
2
4
3
4
3
3
2
_END_

now i want to send the output from the above command to some other file. just like we would do

ls > file.txt

is that possible?

link|improve this question
2  
Just curious: why haven't you just tried this? Seems like little trouble to do so... – wzzrd Aug 4 '09 at 7:23
Very little trouble indeed. :) – John Gardeniers Aug 4 '09 at 9:43
feedback

1 Answer

Yes, you can simply do this:

#!/bin/bash
./runnable inputfile.txt <<_END_ > file.txt
2
4
3
4
3
3
2
_END_
link|improve this answer
feedback

Your Answer

 
or
required, but never shown