Friday, April 19, 2013

Startup script for gnome-terminal



http://www.linuxquestions.org/questions/linux-general-1/run-command-in-new-gnome-terminal-185216/


Open up the start up script here over GUI here.

gnome-session-properties

In that click on ADD and then

1. Give the startup script some name.
2. Give the command as shown

gnome-terminal -x /bin/bash -c "ls"

3. Give what ever comment you want to give and save it.


Next time you login with you credential, a gnome-terminal will pop out of nowhere and it will list all the files.  You can replace the list command with what ever script you want :-D


One more thing I did see the shell which gets spawned getting closed automatically,  In order to prevent that we need to exec bash as shown. Ref(http://stackoverflow.com/questions/3512055/avoid-gnome-terminal-close-after-script-execution)

$ gnome-terminal -e "bash -c \"echo foo; echo bar; exec bash\""


We can also start many sessions in multiple windows with the following command

gnome-terminal --tab --title="Listing" -e "bash -c \"ls; exec bash\"" --tab --title="cat example.txt" -e "bash -c \"cat example.txt; exec bash\""

No comments:

Post a Comment