Dumb question - how to fork in a shell script

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Buettner
Date:  
Subject: Dumb question - how to fork in a shell script
On Nov 6, 1:46am, Shawn T. Rutledge wrote:

> If a program calls a shell script, how can the shell script execute another
> shell script in the background, in such a way that the second script will
> keep executing after the first one exits? I tried just appending an
> ampersand, but it seems like the second script is being killed as soon
> as the first one exits. I thought maybe exec does this, but the bash
> man page says that "exec command" causes the command to replace the
> shell as the current process, rather than to start a new process. I
> need it to actually fork instead.
>
> The context is that I'm trying to get vgetty to convert the .rmd files
> (some weird sound format) into .wav files as it receives them, but that
> causes vgetty to block until this conversion process is done, and it
> can't answer the phone again until it's done. The conversion should be
> a background process.


Try something like the following:

    (command &)&


This does a double fork.

Kevin