LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 10-07-2004, 06:15 AM   #1
kindredstar
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Rep: Reputation: 0
Question How do I get Bash to automatically bg graphical programs without the &?


This isn't precisely a Linux question more a Bash question. I've searched around on the internet and looked at Bash guides etc but nothing seems to have the info I need. So if someone can help please do.

I've noticed that on some distros (and other Unix's) when you run a program from an xterm, which will open in separate window, Bash will automatically background the process. For example if I run 'gvim' then it will open gvim (in using it's gui) but the command prompt (in the xterm) will still come back to the prompt for the next command. And it does this for all graphical programs. So I could just type 'gvim' instead of 'gvim &' or just 'netscape' etc etc.

Basically I'm lazy so I'm wondering if there is a way so that I don't have to type the '&' after everything. I know I can put in my bashrc a function for each program like:

function programname { command programname "$@" & }

but that requires me to do it for every single program that might launch a new window. Isn't there a way so that if a new window is launched then it automatically will background the process in the term?

>> I've modified this to make it easier to understand if anyone was getting confused.

Last edited by kindredstar; 10-07-2004 at 09:37 AM.
 
Old 10-07-2004, 07:26 AM   #2
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I'm not sure I understand your question properly; is this what you are looking for:

"A listing of commands within parentheses starts a subshell."
See page 13 first line of http://www.tldp.org/guides.html#abs.

Last edited by JZL240I-U; 10-07-2004 at 07:28 AM.
 
Old 10-07-2004, 09:30 AM   #3
kindredstar
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Well that's not exactly what I mean. I don't mean in shell scripts. I just mean from the standard shell prompt when I execute a program.
 
Old 10-07-2004, 10:29 AM   #4
ctux
Member
 
Registered: Jul 2004
Location: Catalunya (Països Catalans)
Distribution: Fedora Core 3
Posts: 50

Rep: Reputation: 15
I don't think there's a software to do that, because the people who wants it is to lazy to program it. I'm joking. : )

I'm sorry, i think you'll have to type the & every time. Unless you create a sh interpreter.

bye &
 
Old 10-07-2004, 10:32 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I may be wrong here (Gurus please correct) but I think this is a programmed feature of the applications you run, i.e. these contain in their sources a fork() statement or some such which detaches the executable automatically from the starting process.
 
Old 10-07-2004, 11:05 AM   #6
kindredstar
LQ Newbie
 
Registered: Oct 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Well it's not just that I'm lazy.. perhaps forgetful also.. so if I run a program and forget to put the & then it can cause problems. Some programs don't let you input into them if you background them after they've started via a ctrl-z. I just know that when I was at uni we never had to type the & on Solaris. And my friend said that he thinks that he never has to also on his Fedora machine. So there must be a setting somewhere.. perhaps a list of programs in a config file or something. Or it could just be as JZL240I-U said and it has been compiled into some programs to do that.

If someone else could try out running programs without the & and telling me what the results are with different programs on different distros then we might be able to work this out

Last edited by kindredstar; 10-07-2004 at 11:07 AM.
 
  


Reply



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
automatically launching programs during start up nanjil Linux - Newbie 2 08-09-2005 11:17 PM
Graphical Programs over ssh andrewguy9 Linux - Software 2 02-24-2005 08:30 AM
Start programs automatically for xfce4 laiboonh Linux - Newbie 2 01-03-2005 09:59 PM
How do I start programs automatically with boot up? Kasperisa Linux - Newbie 6 07-15-2004 03:29 PM
How to start programs automatically at boot? onchiman Linux - Hardware 2 03-18-2003 10:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:59 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration