Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

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

Your Answer

 
discard

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

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