RE: [suse-programming-e] call a script in a script
I ended up using /usr/local/bin/job & Thank you! -----Original Message----- From: Randall R Schulz [mailto:rschulz@sonic.net] Sent: Tuesday, May 17, 2005 6:08 AM To: suse-programming-e@suse.com Subject: Re: [suse-programming-e] call a script in a script Phil, On Tuesday 17 May 2005 01:46, 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.
...
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).
True. Parentheses are not simply for grouping (as you say, they create a sub-shell). You get simple grouping of a sequence of commands with {curly braces}. That kind of grouping is merely syntactic (and things like "exit" executed within them will cause the shell interpreting the script to exit. Bailing out of a {curly brace sequence} without exiting the shell that's executing it is what the "return" built-in is for. While what you say about process creation (fork) in Cygwin is true, I don't think we're really considering that here (this is a SuSE list, after all, and Cygwin is owned by RedHat...).
So, instead of the above, just:
exec script_B
Perhaps. Keep in mind that unless the shell that invoked script_A used "script_A &", it will end up waiting for script_B to complete. If you want the parent of script_A to continue on after it (script_A) starts script_B, then you must use "script_B &". "Exec script_B &" is equivalent to "script_B &".
...
Phil
Randall Schulz -- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
participants (1)
-
Patrick B. O'Brien