LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-26-2005, 08:54 PM   #1
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Rep: Reputation: 0
I don't want the terminal to exit!


Well, I have a small problem that hopefully one of you can help me with.


I'm making my fluxbox menu right now, and I have one command like [exec] (fortune) {gnome-terminal -e fortune}

The problem is that it when fortune ends, the terminal ends. All I want to know is if there is a way to keep that terminal open.

Thanks in advance.
 
Old 07-26-2005, 09:27 PM   #2
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Rep: Reputation: 30
If you just want fortune to run when you open a terminal, I'd suggest putting the call to fortune in your .bashrc, rather than in your menu. Every time you open a terminal, your .bashrc is run anew for that particular instance of the terminal.
That way your fluxbox menu entry is just [exec] (terminal) {gnome-terminal}, and fortune will run itself each time you open it.

Code:
[me@localhost ~]$ cat .bashrc
export PATH=$PATH:/usr/sbin/:/home/laura/OpenOffice.org1.1.0/program:/usr/gnat/bin:/usr/java/jdk1.3.1_07/bin/
export PYTHONPATH=/usr/local/lib/python2.2/site-packages/gtk-2.0/:/usr/local/lib/python2.2/site-packages/

#aliases
alias ls="ls --color"
alias ll="ls -l"
alias umount="sudo umount"
alias mount="sudo mount"
alias shutdown="sudo /sbin/shutdown"

#Customize bash prompt to look human...
PS1="[\u@\h \w]\\$ " 

#The last thing in the file
echo "What is your command, my mistress?"
                                                                <--- put 'fortune' in here somewhere
(The other option, if you're intent on doing it the way you've got set up, is *maybe* to add a '&': {gnome-terminal -e fortune &} ...but I'm not sure that'll work. It may not even bring up the window that way)

Last edited by rose_bud4201; 07-26-2005 at 09:31 PM.
 
Old 07-26-2005, 09:32 PM   #3
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by rose_bud4201
If you just want fortune to run when you open a terminal, I'd suggest putting the call to fortune in your .bashrc, rather than in your menu. Every time you open a terminal, your .bashrc is run anew for that particular instance of the terminal.
That way your fluxbox menu entry is just [exec] (terminal) {gnome-terminal}, and fortune will run itself each time you open it.

(The other option, if you're intent on doing it the way you've got set up, is *maybe* to add a '&': {gnome-terminal -e fortune &} ...but I'm not sure that'll work. It may not even bring up the window that way)

Thanks for your help, but I'd want a way to keep the console up after a command is completed. I have several other programs that will exit after they are finished and would like to find a way to keep it up.


The & didn't work :-(.
 
Old 07-27-2005, 11:50 PM   #4
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
I don't know if bumping is rude, but this is on the third page and I would really like some help.

Last edited by dbcoder; 07-28-2005 at 10:59 AM.
 
Old 07-28-2005, 11:00 AM   #5
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
I hope I'm not being annoying, but bump?! I would really like some help.
 
Old 07-28-2005, 11:31 AM   #6
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Rep: Reputation: 30
From all I've seen on Google and trying this myself, you can't do what you want...rxvt just ain't gonna make it happen. If you want a terminal to stay up after you run a program, open rxvt through your menu, and then run whatever program it is you want to run.
 
Old 07-28-2005, 11:50 AM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by rose_bud4201
From all I've seen on Google and trying this myself, you can't do what you want...rxvt just ain't gonna make it happen. If you want a terminal to stay up after you run a program, open rxvt through your menu, and then run whatever program it is you want to run.
Fortune is a simple program designed to display text in your terminal or console, when it displays the random text, it's done. By running in a terminal, it's going to close which is not either the terminal's issue or fortune, it's just how it works. Fortune was not intended to run by a X menu or icon but rather for messages when you login, etc.

My suggestion would be if you really want to be able to click on 'fortune' and read it by the terminal window staying open long enough, write a simple script that calls fortune and then perhaps sleeps for however long you want it to stay open for, which will cause the terminal to stay open for however many seconds you set it to...

I did a test and it worked.. the script would be as followed for you:

Code:
#!/bin/bash
# Script to make the terminal stay open long enough to read the fortune

gnome-terminal -e fortune

# Sleep for 2 minutes so I can read the fortune
sleep 120
Then just name this script whatever you want and place in /usr/bin or whereever and edit your menu to point to this script instead of the gnome-terminal -e fortune portion... so it would look like this:

[exec] (fortune) {/path/to/new/script}

And come to think of it, you could probably just add the sleep portion at the end of your existing fortune link in the menu like this:

[exec] (fortune) {gnome-terminal -e fortune && sleep 120}

Last edited by trickykid; 07-28-2005 at 11:51 AM.
 
Old 07-28-2005, 12:01 PM   #8
ahh
Member
 
Registered: May 2004
Location: UK
Distribution: Gentoo
Posts: 293

Rep: Reputation: 31
You could use an xterm instead.
Code:
xterm -hold -e fortune
 
Old 07-28-2005, 12:03 PM   #9
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by ahh
You could use an xterm instead.
Code:
xterm -hold -e fortune
That's true too.. xterm is better than all other terminals anyways..
 
Old 07-28-2005, 04:41 PM   #10
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by ahh
You could use an xterm instead.
Code:
xterm -hold -e fortune

So close to what I would like. Thanks for your help.

But if it's possible, is there a way that you could return to the prompt to enter commands afterwards?
 
Old 07-28-2005, 09:56 PM   #11
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
I tried gnome-terminal && fortune, but that didn't do a thing. I wonder if there is a way to run a command pointed to a specific terminal open. Hrrrm.
 
Old 07-29-2005, 02:18 AM   #12
ahh
Member
 
Registered: May 2004
Location: UK
Distribution: Gentoo
Posts: 293

Rep: Reputation: 31
Quote:
Originally posted by dbcoder
So close to what I would like. Thanks for your help.

But if it's possible, is there a way that you could return to the prompt to enter commands afterwards?
I don't think it is, but the man page for xterm has a *lot* of options. There may be something there...
 
Old 07-29-2005, 11:19 AM   #13
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
I've looked and there isn't anything that would help/

Man, I really hope this is possible.
 
Old 07-29-2005, 11:28 AM   #14
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Rep: Reputation: 30
Why can't you just have a menu option that opens a terminal, and then just run the command that you want to run? Since you want the terminal to remain active anyway, it can't be that you don't like using the commandline....? The menu won't save you that much time in the long run, really it won't.

If they're complicated program names, or have long options and so on, you could always just set up an alias for them.

in .bashrc:
alias short_cut="long_winded_program_name -with -lots -of -options"
 
Old 07-29-2005, 08:00 PM   #15
dbcoder
LQ Newbie
 
Registered: Aug 2003
Distribution: Ubuntu
Posts: 15

Original Poster
Rep: Reputation: 0
Because it's kinda the whole scheme of my fluxbox configuration. It's just not for fortune, that's just an example.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between exit 1 and exit kushalkoolwal Programming 6 10-20-2005 04:56 PM
Mandrake login won't exit terminal oxwilder Mandriva 2 10-12-2005 06:55 PM
how to exit a terminal changcheh Linux - General 3 08-30-2005 08:55 AM
Terminal Service client full screen exit JVWay Linux - Software 1 03-22-2005 08:51 AM
Loose display on X exit or terminal switch hematose Linux - General 2 08-15-2004 05:22 PM


All times are GMT -5. The time now is 11:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration