I am very new to linux platform.

Looking for a script file to call different application start up file located in different location and needs to be run in different terminals.

For example :

i have two .sh file like a.sh and b.sh in different locations.

Now need a script file to run these .sh file. when i run that script it should be open two terminals . In the first terminal a.sh should be called and b.sh file should be run on second terminal .

Thanks in advance for help.

Regards, Raghu


That is quite simple. Write a script something like this:

xterm -e /bin/bash /path/to/script_1.sh &
xterm -e /bin/bash /path/to/script_2.sh &

The -e option means "execute". The argument after it is the command to execute (here it is /bin/bash) and the next option is the argument for the command (here the name of the script-file). & means that the xterm-commands are running in background. If you remove the first &, it will run the first script completely and afterwards it will start the next command, but as I understood your question you want to run them simultaneously, so leave the & there.

You can also use the standard terminal instead of xterm, but this depends on the distribution and desktop you use. For example in gnome it would be gnome-terminal -x, but it should not make any difference when using xterm.

Hope this helps.

Greatings, Darth Ravage

  • I thought it was gnome-terminal -e (-x seems to work as well, but -e appears in the --help page)... Also, with gnome-terminal, you can get it to hold the terminal open (in preferences, under 'Title & Command'), so you can see the output when the scripts exits. Also, if the scripts being called have the shebang line #!/bin/bash, you shouldn't need to prefix the command /bin/bash (or bash) – Wilf Jul 4 '14 at 9:20
  • 1
    You're perfectly right with the -e. My mistake. I wrote /bin/bash just for the sake of completeness, but as you said it is perfectly possible to just write bash. Thanks for the constructive criticism. – Darth Ravage Jul 4 '14 at 10:35

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.