Way to ‘tee’ input to a program or script

command linestdin

I'm trying to find a way to use an input file for a program in such a way that I can also use stdin.

For example, say I have a SQL script that creates a table. I invoke it like this:

mysql -p database < script.sql

This is great, but it exits out of mysql when the script is finished. Instead, I want to run other queries manually without being logged out of mysql.

I know tee can fork output to the terminal (stdout) and to a file, is there a reverse function that can be used for input, or at least a method that can be applied to most Linux/Unix commands?

Best Answer

cat script.sql - | mysql -p database
Related Question