You are not logged in.

#1 2010-11-17 22:21:17

anon27
Member
Registered: 2010-11-10
Posts: 18

[SOLVED] Killing terminal after a nohup command

I'd like to be able to automatically kill my terminal window after I've issued a 'nohup foobar &' command to avoid window clutter. How can I go about this?

Last edited by anon27 (2010-11-17 22:57:42)

Offline

#2 2010-11-17 22:43:05

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: [SOLVED] Killing terminal after a nohup command

Just append "exit"?

nohup foobar & exit

You might put this into a macro as well:

bind '"\e\C-m":"\C-anohup \C-e & exit\C-m"'

Then just type foobar and press Alt-Return.

Or, if this is all you're using nohup for, you might use a function like this:

nohup () { command nohup "$@" & exit; }

Then just use 'nohup foobar'.

In general, if you want to start programs from bash but avoid window clutter, take a look at bashrun, too.

Offline

#3 2010-11-17 22:56:56

anon27
Member
Registered: 2010-11-10
Posts: 18

Re: [SOLVED] Killing terminal after a nohup command

Lol thanks. Too newb to realize that 'exit' was something that could be appended just like that. Will look into your other suggestions as well.

Offline

#4 2010-11-17 23:08:15

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: [SOLVED] Killing terminal after a nohup command

Note that '&' will background the preceeding command, but will also syntactically separate it from the next command, similar to ';'. That's why you can "just append" the exit command here.

Offline

Board footer

Powered by FluxBB