I am writing a bash script to perform some analysis using the program ROOT. I want to run some initial command to load the result of the analysis, then continue using ROOT interactively.
The analysis part goes along well but the problem is that after root
is executes my initial command, it closes immediately. So far I have tried the EOF (here-file) construct to pass my initial command and I am a bit unfamiliar with shell scripting so I would like to get your opinions on how to keep ROOT
running after the execution of the script. That is I would like to see the ROOT prompt instead of the sytem prompt.
./runReader.py SummerStd 140PU_NM1
root -l SummerStd_140PU_NM1_his.root << EOF
TBrowser a;
EOF
The above code executes the analysis then runs root
; however, it immediately terminates and I have no time to inspect the TBrowser since I have the system prompt instead of the ROOT prompt. I would like control to stay at root
's command prompt after the script sends the TBrowser
command to the program, so I can enter additional commands by hand.
ROOT
is an interactive program with a command-line interface, and he wants the script to enter the first command into it, then revert to allowing him to type subsequent commands. I think the answer to this is to useExpect
. I'm not going to revise my answer, because I don't have enough experience with Expect to show how to do it. – Barmar Aug 04 '14 at 16:02expect
tag. – Barmar Aug 04 '14 at 21:39TBrowser
command and to be able to type more commands at ROOT's prompt, did I understand your question correctly? – Gilles 'SO- stop being evil' Aug 05 '14 at 12:21