Re: [ROOT] How to run root in batch?

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Sat Sep 22 2001 - 17:39:13 MEST


Hi, 

> #!/bin/sh
> . /usr/local/etc/setups.sh
> #
> setup root
> #
> cd /usr/e781/data05/scratch/dauwe/
> # do root in batch mode and quit when finished
> $ROOTSYS/bin/root -b -q {

This makes root to search for the file '{' and then execute it.


>       /usr/e781/data05/scratch/dauwe/Myxc.C;
>       Myxc t;
>       t.Loop();
>     }

These lines are interpreted by /bin/sh again, not by root.

If you want to use lines from the script as input
to root, use a 'here document':

$ROOTSYS/bin/root -b <<EOF
{
      gSystem->Load("/usr/e781/data05/scratch/dauwe/Myxc.C");
      Myxc t;
      t.Loop();
}
EOF

(instead of EOF, you can also use a different string).
The -q must be left out in this case (because there is no
script name given on the command line and root exits
automatically when seeing end of file).


good luck,

André


-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET