Automatically quitting root session

ROOT people,

Any help with this small problem of mine appreciated.

Simple task: read in a root file, produce a histogram from a tree, write the histogram out to disk as a png file.

Twist: want to do this under control of a shell script.


  1. write a root-based stand-alone binary: seems like a lot of overhead
  2. write an unnamed root script: much more sensible but…

For option 2, how do I get root to quit automatically? .q seems only to be understood on the root command line. What is the underlying function? Do I need to use an immediate script? An Expect script?

Secondarily, it seems that both options will create canvases and display them (will they?), which is not necessary in this case. Can that be avoided?

– Mark

root -b -q myscript.C
see the first few pages of the “Getting Started manual”


Thank you Rene. Precisely what I needed.