Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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
add comment

1 Answer

Yes, you can simply do this:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.