Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: fork example - Korn shell

Posted on 2007-06-06 23:21:10 by Prateek

Hi,
I have done fork programming using C language. But being new to Korn
shell scripting, I was wondering if I can use Korn shell scripting for
fork. If YES, can someone please provide me a snippet to get started
with.

Thanks,
Prateek

Report this message

#2: Re: fork example - Korn shell

Posted on 2007-06-07 01:02:13 by cfajohnson

On 2007-06-06, Prateek wrote:
> Hi,
> I have done fork programming using C language. But being new to Korn
> shell scripting, I was wondering if I can use Korn shell scripting for
> fork. If YES, can someone please provide me a snippet to get started
> with.

Use an ampersand to put the job into the background:

COMMAND ARGS &

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence

Report this message

#3: Re: fork example - Korn shell

Posted on 2007-06-07 15:18:22 by Walt Fles

On Jun 6, 6:02 pm, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
> On 2007-06-06, Prateek wrote:
> > Hi,
> > I have done fork programming using C language. But being new to Korn
> > shell scripting, I was wondering if I can use Korn shell scripting for
> > fork. If YES, can someone please provide me a snippet to get started
> > with.
>
> Use an ampersand to put the job into the background:
>
> COMMAND ARGS &
>
> --
> Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
> ===== My code in this post, if any, assumes the POSIX locale
> ===== and is released under the GNU General Public Licence

And then capture $! - which is the process ID of the background job
you just forked.
Then you can check the status of $! to see when it finishes:


COMMAND ARG &
background_pid=$!

Report this message