On Mon, Sep 17, 2001 at 03:25:20PM -0700, Jason Tiller wrote:
> Hi, All, :)
>
> I'm trying to write a short script to remove duplicate entries in my
> PATH variable.
The script I use to do this is
print join ":", grep !$seen{$_}++, split ":", $ENV{shift}
> So, I want to write a script (in Perl, of course!) so that I can use
> it in my .bash_profile like so:
>
> export $PATH=`perl fixpath.pl`
For my script pass the name of the environment variable you are
concerned with.
> So, the perl script would read the PATH, chop out any duplicate
> entries, and write the new path to stdout.
>
> First off, is this the right way to go about this? I know this isn't
> a shell list, but I'm assuming that the perl script can't actually
> *change* the PATH in the parent process - only for its own process.
> Right?
Right. Nothing can change the parent's environment.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]