Re: [ROOT] batch without script

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Thu Jan 11 2001 - 11:50:24 MET


Fons Rademakers wrote:
> 
> Hi Berrie,
> 
>  try this:
> 
> echo '{Float_t b = 1;Int_t c = 2;cout<<b<<c<<endl;}' | root -b
> 

Hi,

most shells (e.g. zsh, bash) allow for 'here documents':

root -b <<MY_EOF_MARKER
{
  Float_t b = 1;
  Int_t c = 2;
  cout<<b<<c<<endl;
}
MY_EOF_MARKER

MY_EOF_MARKER can be an (almost) arbitrary name. You can use this in
shell scripts
as well as interactively.

best regards,


Andre


> 
> On Wed, Jan 10, 2001 at 04:08:57PM -0800, Berrie Giebels wrote:
> >
> >
> > Hi all,
> >
> > Does anyone know if it is possible (and how) to run a ROOT batch with code
> > on the command line and not in a script file?
> >
> > For instance having  script.C that would contain a few lines of code like
> > {
> > Float_t b = 1;
> > Int_t c = 2;
> > cout<<b<<c<<endl;
> > }
> >
> > and then execute that script in a way like
> >
> > root -b {Float_t b = 1;Int_t c = 2;cout<<b<<c<<endl;}
> >
> > instead of
> >
> > root -b script.C
> >  ?
> >
> > Thanks,
> >
> > Berrie
> >
> >
> 
> --
> Org:    CERN, European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23, Switzerland
> E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910

-- 
------------------+----------------------------------
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:50:33 MET