The gnome-terminal manual shows an option to execute a command in the terminal it opens.
-x, --execute
Execute the remainder of the command line inside the
terminal.
But the catch is that once the command finishes, the terminal will close. This thread has a solution for that:
gnome-terminal -x bash -c "echo 'hello world' ; bash"
This will open the terminal and run the bash shell, which then runs the echo
and then bash. This is essentially the same thing as a script like:
#!/bin/bash
echo 'hello world'
bash
So gnome-terminal -x script.sh
should run the echo
and leave you with a bash shell. Once you exit that shell, the original (bash -c
, or #!/bin/bash
) shell will exit, and finally the gnome-terminal will exit.
You can also use the Message of the Day feature, which runs after login on every terminal.