Issue: Create a script that opens a terminal window with multiple tabs, each tab requires a different title to identify its purpose, in addition each tab should display a specific commmand (will not execute the command, the user will need to hit Enter to execute the command).
Example: The user needs to execute 3 commands: ifconfig
, route -n
and top
, the user executes the script and it opens the terminal with 3 tabs, the first tab shows in the title Network
and the prompt shows root$ ifconfig
, the second tab shows in the title Routing
and the prompt is like root$ route -n
, the third tab shows the title Performance
and the prompt shows root$ top
. The commands are not running when the script is executed, the user needs to go into each tab and manually hit "Enter" to execute each command.
I am using the following script to open the terminal with multiple tabs, but am stuck trying to get the other features working, any assistance will be highly appreciated:
#bin/bash
tab="--tab"
cmd="bash -c 'pwd';bash"
foo=""
for i in 1 2 3; do
foo+=($tab -e "$cmd")
done
gnome-terminal "${foo[@]}"
exit 0
#!/bin/bash
(note the exclamation mark). – Tom Fenech#!/bin/sh
and all bashisms for such an easy task better be avoided. – Jens