Re: Using a macro from the command line

From: Axel Naumann <>
Date: Wed, 20 Sep 2006 12:47:24 +0200


this one might be the easiest way:

echo '.L mymacro.C
myfunction(value,value,value)' | root -l -b

Note that the echo '...' string spans multiple lines; this is intentional and feeds the newline to root.

Cheers, Axel.

Rosciano Fabio wrote:
> Hello there list,
> I am new to ROOT and I am learning its working.
> I have to treat various datasets using a function defined in a .C macro.
> My macro works beautifully by starting ROOT, loading the macro and calling the function defined in the macro:
> $ root
> root> .L mymacro.C+
> root> ini()
> root> myfunction(value,value,value)
> What I'd like to do now is to call all these commands from a single command line so that it can be used in bash scripts and such. I have read in the manual that
> $ root -b -l (myfunction)
> is the way to go, and that the best way to load my macro at startup is setting it up in the .rootrc file. If I do that, the macro gets loaded, but using .x instead of .L.
> Can you point me in the right direction about this? How can I include all three commands I give in ROOT in the non interactive mode?
> Thank you for your help!
Received on Wed Sep 20 2006 - 12:47:30 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET