How can I output commands from a bash script to another shell (python, root)?
I want to open a shell from another program from a bash script (especially root is a physics program) and execute several commands in a row.
I know to enter one command:
echo ".L mymacro.C" | root -l
but I need to enter several commands one after the other without closing the root shell (root is not the root user, but an interactive shell for another program)
I tried with parentheses, but that failed:
(echo ".L mymacro.C"; echo "myClass a";echo "a.Loop") | root -l
I need these 3 commands injected into the root shell one by one:
mymacro.C
myClass a
a.Loop
How can I do this from a bash script?
Many thanks.
+3
source to share