For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2007 > change directory help in perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author change directory help in perl
Irfan Sayed

2007-06-21, 9:58 pm

Hi ,

I have written following script. Problem with the script is that it is
not changing the directory as per the foreach loop and because of that
cleartool command is failing. can somebody please help.

Here is the script.

#!/usr/bin/perl -w
@arr = `cleartool lsvob -s`;
foreach(@arr)
{
`cd $_`;
my $dir=system(pwd);
print "$dir\n";
`cleartool mktrtype -replace -element -all -nc -postop uncheckout
-execunix "/us
r/bin/perl
/usr/add-on/puccase_admin/viewtools/unixbin/triggers/empty_br.pl" -ex
ecwin "ccperl.exe
\\\\punas01\\puccase_admin\\viewtools\\u
nixbin\\triggers\\empt
y_br.pl" postop_unco_1`;

Regards
Irfan.


Jeff Pang

2007-06-21, 9:58 pm

Sayed, Irfan (Irfan) 写道:
> Hi ,
>
> I have written following script. Problem with the script is that it is
> not changing the directory as per the foreach loop and because of that
> cleartool command is failing. can somebody please help.
>
> Here is the script.
>
> #!/usr/bin/perl -w
> @arr = `cleartool lsvob -s`;
> foreach(@arr)
> {
> `cd $_`;


Replace `cd $path` to chdir($path).
`..` start a shell which was not the environment of the left perl codes
run in.
Haup

2007-06-24, 11:01 pm

Alyssa Milano and Ashlee Simpson Lesbians Get Messy With Food!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com