Someone is missing the point, I'm not sure who yet.

> -----Original Message-----
> From: Steve Grazzini [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 17, 2003 10:10 PM
> To: Smoot Carl-Mitchell
> Cc: [EMAIL PROTECTED]
> Subject: Re: alias in the shell
> 
> 
> On Fri, Oct 17, 2003 at 04:05:10PM -0700, Smoot Carl-Mitchell wrote:
> > Steve Grazzini <[EMAIL PROTECTED]> wrote:
> > 
> > > Have you actually tried ". perlscript" ?  :-)
> > 
> > This will not work.
> 
> Yes, anyone who tries it will realize this immediately. :-)

Well, I guessed wrong, but I use exec in place of the dot, and it works
fine.

> 
> > system("ENVVAR=whatever; export ENVVAR; command");
> 

This doesn't address the problem, environment variables can be handled
native, but alias assignments can not.  Also, you can't export aliases.
However, system forks a child, so the export only affects the child, this
doesn't get back to the parent.  I think the problem was changed to make the
answer easy.

The other suggestion of returning the alias as:

$aliascmd = `aliasProg.pl`;

Still doesn't address the problem.  So now you know the alias command to
run, but, how do you run it, maybe:

system("$aliascmd");

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");

The $shell variable doesn't have to be hardcoded, it can be read from the
environment (at least on my system).

-Mark

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to