Q:

How can i output commands from a bash script to another shell (python,root)?

i want to open a shell of a different program from the bash script (specifically root - a software for physicists) 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 by one without closing the root shell (root is not a root user, but an interactive shell for a different program)
I have tried with the parentheses, but it didn't succeed:
(echo ".L mymacro.C"; echo "myClass a";echo "a.Loop") | root -l

I need those 3 commands entered in a root shell one by one:
mymacro.C
myClass a
a.Loop

How could i do this from a bash script?
Thank you very much.

A:

Perhaps a here document might work:
$ root -l <<EOF
.L mymacro.C
myClass a
a.Loop
EOF

