Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer

 
discard

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