A
Amy Lee
Hi,
I make a Perl script to add a path in PATH variable of the .bash_profile.
Just like
PATH=/usr/java/jdk1.5.0_09/bin:$HOME/perl:$HOME/shell:$PATH:$HOME/bin
to be
PATH=/usr/local/vice:/usr/java/jdk1.5.0_09/bin:$HOME/perl:$HOME/shell:$PATH:$HOME/bin
There's my code:
$ADD="/usr/local/vice"
foreach $FILE (@ARGV)
{
open $IN, '<', $FILE;
while (<$IN>)
{
if (/PATH=/)
{
chomp;
s/PATH=/;
my @PATH=s/:/ /;
unshift @PATH, $ADD;
print $_;
}
}
close $IN;
}
But when I run this script, it still displays
/usr/java/jdk1.5.0_09/bin $HOME/perl $HOME/shell $PATH $HOME/bin
Could you tell me how to solve this problem?
Thank very much~
Regards,
Amy Lee
I make a Perl script to add a path in PATH variable of the .bash_profile.
Just like
PATH=/usr/java/jdk1.5.0_09/bin:$HOME/perl:$HOME/shell:$PATH:$HOME/bin
to be
PATH=/usr/local/vice:/usr/java/jdk1.5.0_09/bin:$HOME/perl:$HOME/shell:$PATH:$HOME/bin
There's my code:
$ADD="/usr/local/vice"
foreach $FILE (@ARGV)
{
open $IN, '<', $FILE;
while (<$IN>)
{
if (/PATH=/)
{
chomp;
s/PATH=/;
my @PATH=s/:/ /;
unshift @PATH, $ADD;
print $_;
}
}
close $IN;
}
But when I run this script, it still displays
/usr/java/jdk1.5.0_09/bin $HOME/perl $HOME/shell $PATH $HOME/bin
Could you tell me how to solve this problem?
Thank very much~
Regards,
Amy Lee