Reputation:
I need to open a new terminal tab and execute multiple commands on it, how can I do it. I have already tried the following,
gnome-terminal --tab -t "X" -e "cd ~/Desktop/terminal_test;mkdir test"
Here I need to cd into a new directory and create a new folder.
Upvotes: 3
Views: 3227
Reputation: 27486
You can use gnome-terminal. The script below will open 3 tabs running the respective commands..
tab="--tab"
cmd01="bash -c 'ls';'pwd';bash"
foo=""
foo+=($tab -e "$cmd01")
gnome-terminal "${foo[@]}"
exit 0
Upvotes: 0
Reputation: 565
Try this:
gnome-terminal -x bash -c "cmd1; cmd2; …cmdN; exec bash"
Upvotes: 3