Petr Vileta <> wrote:
> ----- 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. 

Sorry, Petr, but I don't think that will do anything useful. In csh,
$path is not an environment variable, it is a special variable that is
kept synchronised with the $PATH environment variable. All perl sees,
when executed from a csh shell, is the $ENV{PATH} environment variable.
Similarly, setting $ENV{path} sets a different environment variable
(i.e. $path) which has nothing to do with the PATH environment variable,
or the $path special variable in any child process that happens to
execute the csh shell, except possibly to cause confusion.

HTH

-- 
Brian Raven 


=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.


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

Reply via email to