Is it possible to start an interactive shell program and inject something to its stdin, keep it running afterwards, and that in a single line?
I'd like to start electron -i (REPL mode) and execute .load index.js right away. It has no switch that accepts code to execute unlike many other REPLs.
echo ".load index.js" | electron -i
will execute but terminate immediately.
Could juggling with filedescriptors somehow achieve this?
Interesting resources
Yes, with expect
, like this:
expect -c 'spawn electron -i; send .load index.js\r; interact'