Quote:
|
Originally Posted by cbkihong
The "exec" builtin in bash (sh on Linux seems to be too) will run the perl process without creating a new process by replacing the original shell process, just like the C exec* family of functions.
So you ought to be able to run a script by "./script.sh" to create a new process and then "exec perl script.pl" to continue execution without introducing a new process, but the original shell script will terminate (control will not return to the shell script).
|
Hmm...okie. So I used exec. This is what I got.
Code:
sh-2.05b$ pwd
/tmp
sh-2.05b$ cat test.sh
#! /bin/sh
exec perl /tmp/test.pl
sh-2.05b$ cat test.pl
chdir("/etc");
sh-2.05b$ ./test.sh
sh-2.05b$ pwd
/tmp
sh-2.05b$
I did a
. ./test.sh and my xterm window just disappeared.
I changed test.pl to contain
Code:
#! usr/bin/perl
chdir("/etc");
and test.sh to
Code:
#! /bin/sh
exec /tmp/test.pl
The pwd still shows /tmp.
vino