Open a Terminal and run a program after Gnome boot.
After FC6 boots, I would like to open a Terminal window on the GUI desktop and then run a text application in that window.
I can open a terminal window by placing an xterm command into Startup: System > Prefs > More Prefs > Sessions > Startup > add xterm That works. (There are probably more elegant ways to do this) Then I should be able to follow xterm by the program I want. Suppose I want to run "cal" after the terminal is opened. Then I might use the following command in Startup: xterm && cal or xterm && ./usr/bin/cal However, the above two lines don't work for me in Startup. Any thoughts on how to automatically start a program in the opened Terminal window? Thank you. |
Check out the -e argument to xterm, i.e. do "xterm -e myprogram". You can find more details in "man xterm".
|
Quote:
|
When I run the following in Startup,
xterm -e cal what happens at boot is that a Terminal window opens only for a fraction of a second (can't tell if I can see cal), and then the Gnome GUI Desktop appears. The xterm Terminal does not persist on the Desktop. If I run xterm alone, a terminal appears on the Gnome desktop and stays there. |
Try this:
xterm -e "cal && bash" The basic idea is that xterm runs a program and when program ends, it also ends. cal is not an interactive program so it ends just after calendar is displayed, so you need another program to tell xterm that there is still something to do. You could write a sript running infinite loop, so you won't have to run bash, for example. Or you could right a very small application which will ask for input, almost emulating system idle process. Here is the code: Code:
#include <stdio.h> xterm -e "cal && ./a.out" |
anupamsr, It worked! But I think it is the quote marks (" ") that made it work. Why do you think the quote marks are necessary?
Instead of cal, I tried top because top is slightly more interactive. xterm -e "top" << added to Gnome Startup Of course, when you Q top, the Terminal closes. I could keep the terminal open after quitting top if I do this: xterm -e "top && bash" Thanks to all of you for your help. Case closed. BTW, In what file are all of the Startup commands, such as the ones I am entering, stored? |
Quote:
|
Quote:
Code:
xterm -e xterm -e "top && bash" means well, Code:
xterm -e |
Case closed again. Thank you.
BTW, In what file are the Startup commands I am entering actually stored? |
All times are GMT -5. The time now is 07:15 AM. |