I have a command that needs to be called like this:
command "complex argument"
If I want to run gnome-terminal by passing this argument to it, it will look like this:
gnome-terminal -e 'command "complex argument"'
I want to open several tabs in the terminal, each time executing this command with different arguments. This works as follows:
gnome-terminal -e 'command "complex argument1"' --tab -e 'command "complex argument2"'
But the problem arises if I want to execute it with a script, where I get the parameters for each tab from the loop (i.e. the number of tabs is a variable). My main idea was that I collect the arguments for a single variable and then pass it to gnome-terminal. But I donβt know how to do this, leaving all the nested arguments intact. Either everything is compressed in one argument (if I call gnome-terminal "$args" ), or it falls apart with each space (if I call gnome-terminal $args ).
Is there a way to compose such complex arguments in bash? Or, alternatively, is there a way to send IPC messages to the gnome terminal, telling it to open a new tab and execute the command? I know that I can do this using Konsole, but now I want to do this using gnome-terminal.
source share