On Tue, Oct 21, 2003 at 11:35:15AM -0700, LoBue, Mark wrote:
> Someone is missing the point, I'm not sure who yet.
I'll admit to going on a tangent... :-) The original topic was how
to create a shell alias from Perl.
> No, that won't work, because the alias command is running in a forked child.
> I still think you need to:
>
> exec("aliasProg.pl");
>
> Then, at the end of aliasProg.pl, exec("$shell");
I don't know what else you were planning to do in aliasProg.pl, but
the *only* way to create a shell alias is to have the shell interpret
a line that looks like "alias this=that".
Since the list of aliases is the shell's internal data, you can't expect
it to survive across an exec()...
Now: the easiest way to create a shell alias from Perl is
#
# in the shell
#
eval `script.pl`
#
# in Perl
#
print "alias this=that";
Or you could arrange for Perl to write a little shell script and for
the shell to source that script. But as I'm sure someone has already
suggested, the thing to do is write everything in 100% Pure Perl(tm).
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]