Phil Betts wrote:
On Tuesday, May 17, 2005 2:23 AM, William A. Mahaffey III wrote:
Patrick B. O'Brien wrote:
Using ksh.
I want to call script_B from script_A.
I don't not want script_A to hang around for script_B to finish.
I tried bg but no joy. Script_A sits and waits for script_B to finish before moving on; which is no good. Any thoughts and thank you.
inside script_A:
(script_B &)
The parentheses may not be required, my man page was for ksh on SGI, I don't have it on my SuSE 8.2 box. YMMV & all that.
Whilst this will work (although I have worked on systems where the parent process still hangs around), it's not very efficient...
The parentheses create a new process which in turn creates a new process for script_B (because of the &). On some systems (e.g. cygwin on Windows), process creation carries a hefty price. Far better is to use the ksh builtin exec command which replaces the current process (i.e. "ksh script_A") with the new process (i.e. ksh script_B).
So, instead of the above, just:
exec script_B
From the ksh man page:
exec [argument ...](1) If argument is given, the command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments can appear and affect the current process.
HTH,
Phil
Hmmmm .... wouldn't that wipe out the current instance of script_A ? I thought he wanted script_A to continue after kicking off script_B .... -- William A. Mahaffey III --------------------------------------------------------------------- Remember, ignorance is bliss, but willful ignorance is LIBERALISM !!!!