----- Original Message ----- From: "Arijit Das" <[EMAIL PROTECTED]> To: "[email protected]" <[email protected]>; "[email protected]" <[email protected]>
Sent: Tuesday, May 30, 2006 8:51 AM
Subject: How to modify $ENV{PATH} portably?


Hi,

The format of env variable PATH seems to change with
OS/shell. For example,
in sh it is like

"/dir1/bin:/dir2/bin:."

while in csh, it is like

(/dir1/bin /dir2/bin .)

I need to search for "/dir2/bin" path component in my
$ENV{PATH}, and then, insert "/newpath/bin" just
before "/dir2/bin". But due to different format of
PATHs in different os/shells, I am not able to do that
in a very clean way.

Is there any Perl Array (somewhat like @INC) which I
can modify to have my PATH changed?

Just put into $ENV{} new value
   $ENV{'path'} = '/dir1/bin /newpath/bin /dir2/bin .';
or use regexp to modify it.
This change is valid for current running skript and operating system know nothing about path change.

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.)


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to