Super User is a question and answer site for computer enthusiasts and power users. 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

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?

share|improve this question
    
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
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
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .