Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: nohup dies



"Pau Amaro-Seoane" <vim.unix@xxxxxxxxxxxxxx> writes:

[snip]
>>zsh creates a pipeline
>> zsh forks:
>>    In the subshell, "nohup cat ./input" is run
>> zsh forks again
>>    In the new subshell, ~pau/executables/... is run
>
>>So the "nohup" doesn't cover the second executable.
>
> can you tell me of a more robust/elegant way of doing it?

Well, let's take your original command:

(nohup) cat ./input | ~pau/executables/NB4_NoPN > diagnostic&

Why not add a nohup before the second executable in the pipe?  :

nohup cat ./input | nohup ~pau/executables/NB4_NoPN > diagnostic&

If you don't like that, then why not wrap the whole thing up in a new
invocation of a shell? :

nohup zsh -c 'cat ./input | nohup ~pau/executables/NB4_NoPN > diagnostic ' &

You could disown the job after it's been spawned, too.

While we're here, it should be observed that if you were disciplined or
pedantic enough not to be wasting a fork() running cat justonefile |, you
wouldn't have had this problem in the first place:

nohup ~pau/executables/NB4_NoPN < input > diagnostic &

> But zsh is supposed to emulate ksh, right?

And the polite bits of every other shell ;)

> the "solution" for now is to launch the simulation with ksh... or resort
> to screen... but it's a pity, I stick to zsh a lot

Screen has its place.

HTH,

~Tim
-- 
http://pig.sty.nu/
http://scot-pics.sty.nu/



Messages sorted by: Reverse Date, Date, Thread, Author