I have a script that I want to use to open new terminals and type commands in them. A command likegnome-terminalopens a new terminal. Also, if I dognome-terminal -e myprogram1it will execute myprogram1 in the newly opened terminal. But what if, after myprogram1 completes, I want to execute myprogram2? I cannot do something likegnome-terminal -e myprogram2because it will open a new terminal.Is there a way to specify in the script that I want to execute both myprogram1 and myprogram 2 in the same new terminal? Or would I have to create a new script and do something likegnome-terminal -e scriptToExecuteMyPrograms1And2
How to execute more than one command in a newly opened terminal?
shell script;terminal
You can accomplish what you want like this:$ gnome-terminal -e bash -c '<cmd1>;<cmd2>;exec $SHELL'This will open up <cmd1>, when that's complete, it will open up <cmd2>, finally it will leave you at a command prompt exec $SHELL.For example:$ gnome-terminal -e bash -c 'vim;vim;exec $SHELL'Runs vim, if I close the 1st vim, a 2nd vim is started. When the 2nd one closes I'm left at a terminal prompt.