Accessing a built histogram with a bash script?

Hi, Rooter,

I’m trying to code to get the mean value(for instance) of a histogram created with ROOT via a bash script.
Imaging I have a root file named as “file.root”, one of its histograms is “h”, I obviously can get its mean value by calling h->GetMean() on root command line.

What I wanted is do it via a Linux command line (or bash script).
For instance, under Linux command line, my command looks like :
root -l -b -q file.root h->GetMean()

The error message is Linux doesn’t know what is “h”.

Probably, I can do it by developing a new script like script.C,
and run like “root script.C” to get the mean value of a histogram.
But this is a big change to my script therefore it’s not my primary option .

Could you please present suggestion(s) ?

Thanks a lot !
Junhui