Script to open terminal and show the output of the running commands

I preface this by saying I am pretty much a complete noob when it comes to script writing.

Anyway, I am looking to create a script that opens a terminal in the GUI environment of Ubuntu, and when it does, shows the output of the other commands running in the script.

The reason for this is I am looking to take the script, throw it into the directory that runs scripts on log in and have it opening a terminal, run my normal update scripts and then keep the terminal open to allow me to continue after.

My reason is basically to just get more experience, and I figured to automate something I do every time I login.


I want to run 1 script. Basically I want on login to have terminal automatically open, and then have apt-get update/upgrade/dist-upgrade run, showing the output in that screen. That's all.

Make sure your script is executable and add this command to Startup Applications:

gnome-terminal -e 'bash -c "sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade; exec bash"'

This will open gnome-terminal, which will start a non-interactive bash shell (which will run sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade) and will later replace the current shell with an interactive bash shell.

If you have sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade already in a script, it would probably be more pratical to set Startup Applications to launch the script and maintain the script instead of the command in Startup Applications:

gnome-terminal -e 'bash -c "/path/to/script.sh; exec bash"'