2

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?

1
  • And also, how can I receive first input not from a file, but from a constant, like this: somecommand <<< "someinput"?
    – Septagram
    Nov 8, 2011 at 18:57

1 Answer 1

1
  1. cat myfile - | program

    or

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

    (echo "someinput"; cat) | program

You must log in to answer this question.

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