2

My Bash Script:

#!/bin/bash
cd dataset/
root
.x Pushkar_Soni.cpp

What I am trying to do is:

1) launch root by command root

2) Inside the launched program root I want to run scripts .x Pushkar_Soni.cpp

But what happening is my last command .x Pushkar_Soni.cpp is executed after I quit root by the command .q, I want my last command to run Inside the program root

Pushkars-MacBook-Air:Pushkar_Soni pushkarsoni$ bash ./build.sh
 ------------------------------------------------------------
| Welcome to ROOT 6.17/01                  https://root.cern |
|                               (c) 1995-2019, The ROOT Team |
| Built for macosx64 on Mar 18 2019, 16:04:57                |
| From heads/master@v6-16-00-rc1-1322-gf3f829884a            |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
 ------------------------------------------------------------

root [0] .q
./build.sh: line 4: .x: command not found
Pushkars-MacBook-Air:Pushkar_Soni pushkarsoni$ 
  • 1
    From what I can tell from roots man page, its signature is "root [options] files", meaning you should be able to just say root Pushkar_Soni.cpp instead of the last two lines in your script. – Entropy0 Mar 22 at 17:26
  • @Entropy0 You Solved my Exact Problem. Tq – Pushkar Soni Mar 22 at 17:31
2

From what I can tell from roots man page, its signature is

root [options] files

, meaning you should be able to just say

root Pushkar_Soni.cpp

instead of the last two lines in your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.