Subject: Re: bash and '&'
From: [email-masked] (Wei Ku)

7 Apr 1998 04:07:36 -0700
Message-ID: <[email-masked]>
Reply-To: "Wei Ku" <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: "Earnie Boyd" <[email-masked]>
Cc: <[email-masked]>

I have access to two kinds of different IBM machines : RS6000 workstation
and SP2 ( yes, the one that beat human in chess ).

The bash used in the workstation is version 1.14.7(1) compiled by the system
administrator; the one used in SP2 is version 2.01.0(1) compiled by me. I am
not aware of any special setting to keep the background job alive. I simply
compile it "out of the box".

Also, I just did a simple test on the PC running NT Workstation running
gnu-win32. I got the same behavior ( the background job survives when "exit"
is executed ).

One possible solution ( thanks to your information about bash ) is that
"exit" command always "disown" the background jobs. That is, "exit" is not
equivalent to receiving a `SIGHUP' signal. Of course, I am just guessing.

Any explanation on the subject is appreciated very much.

P.S.: I check with the command "disown". It is a shell builtin only for bash
( not in csh or ksh ).

Wei Ku

-----Original Message-----
From: Earnie Boyd <[email-masked]>
To: [email-masked] <[email-masked]>; [email-masked] <[email-masked]>
Date: Tuesday, March 31, 1998 9:20 AM
Subject: Re: bash and '&'

>
>
>>Reply-To: "Wei Ku" <[email-masked]>
>>From: "Wei Ku" <[email-masked]>
>>To: <[email-masked]>
>>Subject: Re: bash and '&'
>>Date: Fri, 27 Mar 1998 18:15:50 -0500
>>
>>You are right about '&' which originally means "background".
>>
>>However, if one runs a job with '&' in bash or use 'ctrl-z' + "bg"
>>combination to send a job to background, the job will survive even one
>log
>>out of bash with "exit" command. That it, it is still running with PPID
>= 1.
>>This is "equivalent" to the functionality of "nohup" command. I
>accidentally
>>found this nice feature on IBM AIX machine. After that, I have not used
>>"nohup" anymore -- too lazy to type ;-)
>>
>>I do not know how bash achieves this. I just know that this is really
>great
>>if one submits a long job without using "nohup" command and decide to
>log
>>out. Based on the test I did on AIX machine, ksh did not do this.

>This is
>>one of the reason I switch to bash. )
>>
>>Please correct me if my idea is not right. Also, if someone knows how
>this
>>is done in bash, I would love to understand how it is done by bash.
>>
>>Thank you in advance.
>>
>>Wei Ku
>
>This is taken from the bash.info file:
>---from bash.info---
>The shell exits by default upon receipt of a `SIGHUP'.  Before exiting,
>it resends the `SIGHUP' to all jobs, running or stopped.  To
>prevent the shell from sending the `SIGHUP' signal to a particular job,
>remove it from the jobs table with the `disown' builtin (*note Job
>Control Builtins::.) or use `disown -h' to mark it to not receive
>`SIGHUP'.
>---end bash.info---
>
>I could find no switches to force this to happen automatically.  Perhaps
>the AIX bash you used was modified to allow this to happen.
>
>>
>>-----Original Message-----
><snip>
>
>
>-        \\||//
>---o0O0--Earnie--0O0o----
>[email-masked]
>------ooo0O--O0ooo-------
>
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".