2

How can I execute a command inside ROOT that I launch within the bash script? My aim is to have ROOT execute its GUI file browser and have it open if the user does not interfere with keyboard commands. I tried but failed since the GUI file browser stays open for a really short period of time. Is it possible that I modify the bash script and have the program open when the script terminates?

The description of ROOT can be found in the following link:

http://root.cern.ch/drupal/

Vesnog
  • 679
  • 4
  • 11
  • 29
  • 1
    Yes, a program can execute another program. What program is it? Your question is as vague as “can I drive a car on a road”. What is your actual question? – Gilles 'SO- stop being evil' Aug 01 '14 at 22:04
  • @Gilles I edited the question for clarity, thanks for pointing out the ambiguity. – Vesnog Aug 01 '14 at 22:17
  • Your question is still unclear. If program A has a command prompt, type the command at the command prompt. You seem to be running into some kind of problem, but you need to tell us what that problem is. – Gilles 'SO- stop being evil' Aug 01 '14 at 22:19
  • @Gilles Yes program A has a command prompt and I invoke the command by using the construct EOF, but when program A is closed without my interference and I would like to have it open as much as I please. Thanks for your interest by the way. – Vesnog Aug 01 '14 at 22:26
  • It seems that program A is doing something peculiar. **What is program A**? You need to give us the information! – Gilles 'SO- stop being evil' Aug 01 '14 at 22:46
  • @Gilles I edited my question and I hope it is clear enough now. – Vesnog Aug 02 '14 at 11:06
  • What is ROOT? Can you give a link to a description of that program? With a name that's identical to a Linux concept except for case, it's hard to google. – Gilles 'SO- stop being evil' Aug 02 '14 at 16:38
  • Okay editing it once more, you can find the description of ROOT in the provided link. – Vesnog Aug 03 '14 at 18:43

1 Answers1

5

just type the command and it will be executed:

#!/bin/bash
ls -l

if you want to run other shell scripts use:

sh otherShell.sh

or for executable files:

. otherShell.sh

gnuplot is as other commands, you can use it inside shell script:

Example:

#!/bin/sh
lib=$1
old="output/old/$lib.dat"
new="output/new/$lib.dat"

gnuplot << EOF
set logscale x
set logscale y
set size square
set grid
set pointsize 1
plot "< paste $old $new" using 1:4 ti '$lib'
EOF

for the problem "it was giving no time for view and interaction with the GUI launched within the application": you can tell gnuplot to print the plot to file, which you can open up and view yourself:

plot '<SOME FILE>' .......

Or you need to invoke gnuplot with a flag:

gnuplot --persist

to ensure that plots stay up after gnuplot quits.

Sources:

automate gnuplot plotting with bash

http://www.unix.com/shell-programming-and-scripting/146860-using-variables-gnuplot-within-shell-script.html

Nidal
  • 8,856
  • 11
  • 55
  • 74
  • My point is that I will launch an application with the command say GNUplot ,it will be ROOT Data Analysis Framework in my case, and pass some command to be executed inside GNUplot. – Vesnog Aug 01 '14 at 22:05
  • Thanks for the edit it will be helpful, I think this will also work with other programs. – Vesnog Aug 01 '14 at 22:09
  • @Vesnog Yes as I know. – Nidal Aug 01 '14 at 22:10
  • It works as intended but the application is closed immediately, giving no time for view and interaction with the GUI launched within the application(ROOT). – Vesnog Aug 01 '14 at 22:23
  • @Vesnog, see Updates – Nidal Aug 01 '14 at 22:34
  • Since GNUplot is much more familiar to everyone I gave it as an example. The program I use is ROOT which is an OOP data analysing software used in particle physics. – Vesnog Aug 01 '14 at 22:38
  • @Vesnog, I have found this [PDF](http://www.tunl.duke.edu/documents/public/root/material/5/perdue_root_071509.pdf) I guess `Compiling and Running the Program Using a Shell Script section` will help you out – Nidal Aug 01 '14 at 22:46
  • Well thanks that is the program I use and I can write the shell script now, but the browser windows is not displayed long enough for me to interact with it. – Vesnog Aug 02 '14 at 11:24