I'd like to know if it's possible to send some to a command's stdin and then keep reading from the terminal.The problem i'm trying to solve is executing some initialization code every time i open a Node.js REPL, so i have some functions available at the REPL from the start. Basically, to automate this:$ node> require('./myutils')> ... continue using the REPLI now i can use here string to send some text to the command's stdin:$ node <<<require('./myutils')That will execute my initialization code, but will also close the REPL immediately after that.Maybe there's another solution for this particular problem with Node.js, but i'd look to know if there's a general way of mixing input from a string or file and then keep reading from the terminal.Update: Chris Down's solution work, but the Node.js REPL won't run in the interactive mode by default (this is expected, as we're not reading from a terminal). Luckily, there's an -i option to force the interactive mode in the Node.js terminal:{ echo require('./myutils') ; cat ; } | node -i
How to send text to a command and THEN read from terminal
bash;shell script;node.js
{ echo require('./myutils') ; cat ; } | nodeBe aware that your REPL environment may act differently when taking input that's not from a terminal (for example, the prompt may not appear).