I am trying to make a script on the following basis:

  1. Open a terminal window (keep it open) and run cd ~/dir/dir/dir ./exec

  2. Open a second terminal window (keep it open) and run /usr/bin/xterm -font/size/parameters

In the xterm window, cd ~/dir/dir ./executable

  1. Open another terminal window (and keep it open) and run cd /dir/dir ./executable file

  2. Finally open a last terminal window to run an executable file.

Any help/hints will be highly appreciated. Thank you. Sabri

  • I don't understand what you want: open 5 terminal emulations, one times one in another and run 3 different programs? What is the problem? – Ingo May 21 '18 at 18:02
  • What kind of script? sh, python, etc...? – scitronboy May 21 '18 at 18:49
  • Purpose is to run all in an unique sh script, even better if such script runs at boot time when rpi3 starts on. – Sabri May 22 '18 at 7:58
  • why do you need separate terminals? – Chad G May 22 '18 at 15:18
  • Because each terminal opens a program and cannot be closed, must be kept open, otherwise the main program ends up and does not work. The 4 terminal windows should open all at the same time and not sequentially. – Sabri May 22 '18 at 17:21
/path/to/program1 > logfile &
/path/to/program2 > logfile &
/path/to/program3 > logfile &
/path/to/program4 > logfile &

The & will cause the program to be launched in the background, allowing the next line to be executed before the first one finishes. This will allow all 4 to be launched at the same time. The output of each will go to the same file named 'logfile' this could be changed to each output to their own file.

  • 2
    Quality answers explain how they work. – Steve Robillard May 22 '18 at 20:31
  • Each program should be kept open and monitorized to see what's going on (it is not valid a unique output but 4 ones) All 4 programs should be minimized or maximized any of them at will. – Sabri May 23 '18 at 12:51
  • I meant all 4 terminal-windows (running each program) should be minimized or maximized at one's will.... sorry – Sabri May 23 '18 at 17:58

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.