[SunHELP] for loop changes nohup?

Richard Russell richard.russell at db.com
Mon Nov 22 04:33:14 CST 2004

Thanks -- my immediate thought on this is that it could explain the 
opposite behaviour more likely than what I actually see...

ie you're suggesting this:

./start: ...
ksh --> sh --> nohup --> ksh --> nohup & --> java

for i in one; do ./start; done ...
ksh ( --> ksh subshell ) --> sh --> nohup --> ksh --> nohup & --> java

Why would exiting the ksh from the for loop example be more likely to 
cause the java process to exit than it would in the first example? 
Certainly, I would have expected that the nohup would catch the signals 
anyway, so a change at this point shouldn't affect the java process, but 
why would adding a subshell affect it?

Then again, I've never really understood how signals propagate...

Does anyone have any other ideas?

Richard Russell 
Deutsche Bank AG London 
Global Markets Customer Solutions
Office: +44 (0)20 7545 8060
Mobile: +44 (0)79 0661 2237

"Sheldon T. Hall" <shel at cmhcsys.com>
Sent by: sunhelp-bounces at sunhelp.org
11/19/2004 06:26 PM
Please respond to The SunHELP List
        To:     "'The SunHELP List'" <sunhelp at sunhelp.org>
        Subject:        RE: [SunHELP] for loop changes nohup?

 Richard Russell writes ...

> It seems that running 
> a command within a for loop is quite different to running it 
> directly, at least in regards to how nohup works...

I believe some shells run the innards of loops in a subshell.

I know this is true of Bourne shells when the loop is redirected (see 
of O'Reilly's Unix Power Tools, 2nd ed.), but I think it's true in other
cases, though I can't find a ref off-hand.

Could that explain what you're seeing?

SunHELP maillist  -  SunHELP at sunhelp.org

More information about the SunHELP mailing list