On Fri, 2002-10-11 at 23:08, Michael Fowler wrote: > On Fri, Oct 11, 2002 at 04:40:30PM +0100, mike wrote: > > ../build.pl > > /root/cvs/esound # this the output of $dir3 > > / > > > > cannot change No such file or directory at ./build.pl line 13, > > <BLD_LIST> line 55. > > this is ls in same directory, as you can see esound is there > > I don't have any context for what the three lines you output are. The > reason you can't chdir, though, is clear; now all you have to figure out is > why you're getting an error. I can assure you it's not because either Perl > or the chdir function is broken, so it must be something else. > > Perhaps your current directory isn't what you think it is. I'd suggest you > make it more clear in your print; i.e. something along the lines of: > > print "cwd: ", getcwd(), ", chdir to: $dir\n"; > chdir($dir) || die("Unable to chdir to directory \"$dir\": \l$!.\n"); > > That way you know where you are in the filesystem, and what you're trying to > chdir to.
I have fixed the problem now, it turns out it was not a problem but one of context with shell commands, by using system instead of backticks it works thanks for help for info - revised script (I wrote in bash in the end but just wanted to work out why it wasn't working) #!/usr/bin/perl -ww open(BLD_LIST,"buildlist"); my @pkg=<BLD_LIST>; my $ver=$ARGV[2]; my $name=$ARGV[0]; my $release=$ARGV[1]; foreach my $pkg (@pkg){ my $dir1=$pkg; $dir1=~chomp $dir1; use Cwd; $dir0=getcwd(); print "$dir0\n"; chdir $dir1; $dir2=getcwd(); print "$dir2\n"; system './autogen.sh'; chdir $dir0; $dir3=getcwd(); print "$dir3\n"; } > > Michael > -- > Administrator www.shoebox.net > Programmer, System Administrator www.gallanttech.com > -- > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Linux, Gnome what more do you need http://www.redtux.demon.co.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]