How can I run a program in bash in such a way that first it receives some input from a file, and then, as the file ends, it will receive input from terminal?

link|improve this question

67% accept rate
And also, how can I receive first input not from a file, but from a constant, like this: somecommand <<< "someinput"? – Septagram Nov 8 '11 at 18:57
feedback

1 Answer

up vote 1 down vote accepted
  1. cat myfile - | program

    or

    cat myfile /dev/stdin | program
  2. Use echo, which has the same end result:

    (echo "someinput"; cat) | program
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.