Home > linux > Open multiple terminals in a for loop in bash

Open multiple terminals in a for loop in bash

September 19Hits:1
Advertisement

Recently i changed to lxde on Ubuntu. And after switching it changed my x-terminal-emulator to lxterm.

My script was doing the following:

Go through a for loop and open a new terminal window and then run a script in that terminal. It would open multiple terminals at the same time running that script in all the different windows.

After switching to lxde it will loop through and wait for each terminal window to finish the script before the next terminal window launches. I want it to do what it was doing.

I fixed this issue by changing my x-terminal-emulator back to the gnome-terminal. Now it works fine. HOWEVER, this is a script system that a few people use and they are all using different environments and terminal emulators. How can i make sure this works for all the different terminal emulators or at least for xterm or whatever the one EVERYONE would have.

Thanks



Code snippet:

for blah in something do     x-terminal-emulator -e bash my_script.sh done 

Answers

This should do

for blah in something
do
    x-terminal-emulator -e bash my_script.sh &
done

Related Articles

  • Open multiple terminals in a for loop in bashSeptember 19

    Recently i changed to lxde on Ubuntu. And after switching it changed my x-terminal-emulator to lxterm. My script was doing the following: Go through a for loop and open a new terminal window and then run a script in that terminal. It would open multi

  • On a linux server how do you use multiple terminals over a single ssh connection?May 1

    I often find myself opening several ssh connections in order to view several log files at a time with tail -f. This isn't a problem when I'm at home because I use public key encryption for password-less login. However, I will often use computer at my

  • Utility to send a command to multiple terminals?September 15

    A while ago when I did a lot more system admining, there was a little utility that would send a command to multiple terminals that I had open. So essentially I could ssh into three different servers, then type tail -f /var/log/some_error.log into the

  • How to create multiple "terminals" for a linux workstation?November 3

    I wanted to figure out how to have multiple terminals (monitor, keyboard, and mouse) use a single centralized system. I guess at this point I can get computers for around $150, and use them as dumb terminals, but I would really like to centralize abo

  • Multiple Terminals displayed as a grid in one window

    Multiple Terminals displayed as a grid in one windowNovember 16

    Is there a way to have one window display more than one terminal at once? (Not in the typical tabbed configuration, more like a grid of arbitrary number of terminal screens) Ideally I'd like to have a 3 column by 2 row window with 6 terminal instance

  • How do I open multiple terminals?

    How do I open multiple terminals?May 15

    I just downloaded Ubuntu 11.04 and as far as I can remember, there was the option of opening multiple terminals in tabs in Ubuntu. I cannot discover this feature in 11.04. Also, as a general query, suppose I open emacs from the terminal, then I would

  • How to run multiple terminals on remote ubuntu server through ultravnc?July 29

    I am trying to simultaneously run multiple instances of my application from terminal on remote ubuntu server. Single terminal is required for running a single instance of application. I am accessing remote server through putty and ultravnc viewer. Ev

  • How to work with a master database and multiple terminals

    How to work with a master database and multiple terminalsSeptember 18

    We have a main database in postgres used to assemble updates using flyway and modified from a single terminal. Now we want to know what the best way to work with multiple terminals making changes to the same database structure. For this we can think

  • How to execute a command in multiple Terminals by executing a command in only one?

    How to execute a command in multiple Terminals by executing a command in only one? December 1

    This question already has an answer here: Is there an SSH client which duplicates commands to multiple terminals? 2 answers I am going to have multiple machines that I am going to connect to via SSH so I am going to have multiple Terminal windows up,

  • C++ Multithreading program example using multiple terminals in the same computerJanuary 22

    I am new to multithreaded programming. I am trying to run a program using two terminals in one laptop. Wherein, in these two terminals it should be registered as user1 and user2 and before the 2 programs start running, one of them should wait for the

  • How to iterate through multiple id's using while loop in sql serverFebruary 11

    How to iterate through multiple id's using while loop in sql server and after every loop show error message DECLARE @InventoryId Int Select @InventoryId = I.InventoryId From G2owner.LoadSlip L (nolock) Inner Join G2owner.LoadSlipReleaseOrderMapping L

  • For loop in bash scripting April 17

    The following for loop in bash gives an error - line 42: 1 2 3 4 5 + 1: syntax error in expression (error token is "2 3 4 5 + 1") line 42 is statement - num1=$[$i1 + 1] for i1 in `seq 1 5` do num1=$[$i1 + 1] for k1 in `seq $num1 5` do ky1="

  • Continous Loops in BashNovember 18

    I'm interested in writing a program that will get the size of the mail spool file for the user. (The spool files found in /var/spool/mail/$USER on Linux). To do this, I would like to create a continuous loop that excutes once every 30 seconds. Each t

  • Mounting multiple img files as single loop deviceJuly 20

    Is there a way to take a disk img file that is broken up into parts and mount it as a single loop device? --------------Solutions------------- I don't think you can do it in place but if you have enough space this should work: # Create the files that

  • Bash history handling with multiple terminalsNovember 18

    I use mainly Terminator, and it's usually opened with 3 split terminal windows. I also use Gnome terminal for various reasons. I'm wondering how is bash history handled in this case as I sometimes miss previously issued commands when I run history Fo

  • How to properly add multiple form elements in a loop?April 3

    I have a form where I need to loop through an array and display multiple form elements in a specific area. Example: $form_layout = 'Some html'; $form_layout .= '<div>'; foreach($something as $key => $value) { $form_layout .= 'some html'; $form_la

  • How to place multiple form elements from a loopApril 3

    I have a table that will have multiple table rows that are generated dynamically using a foreach loop. In these rows will be textfields using the Drupal forms API. Example: $f = '<table>'; $f .= '<tr><td>Something...</td></tr>

  • Can I login to multiple terminals with the same user safely on Linux?April 20

    By terminals I mean the ones you can switch to using Ctrl+Alt+F1-F6. I know I'm able to login multiple times but does this have any side-effects? --------------Solutions------------- *NIX is by design a multi-user system, so there is not going to be

  • Why does my computer show multiple terminals open Ubuntu 13.10November 25

    I am running a c program that records the number of terminals open and then lists them but when I run it I am shown multiple terminal windows open when only the one is, why? --------------Solutions------------- The most likely reason is that there ar

  • Creating multiple screens in a for loop to run parellel programs and sending commands to eachMarch 27

    Before flagging this questions as redundant, i have read and tried every answer to similar questions with no success I have this loop where it traverses a directory structure, and runs a program (which takes minutes to finish) in each subdirectory in

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.604 s.