|
Academic Work Personal
|
Perl /
Changing Directories in Perl
DescriptionHere is a simple script for demonstrating chdir and getcwd in Perl. Purpose of the script: it enters in each direct subdirectory and executes a given script therein. The Script
#!/usr/bin/perl -w
# AUTHOR: Jabba Laci, jabba.laci@gmail.com
use strict;
use Cwd;
use IO::File;
my ($item, $dir);
my $baseDir = getcwd;
my $cmd = "./compile.sh";
foreach $item (<*>)
{
if (! -d $item) { next; }
# else, if it's a directory
$dir = $item;
chdir($dir);
print $dir."\n";
#print " ".$cmd."\n";
system($cmd);
chdir($baseDir);
}
|
![]() anime | bash | blogs | bsd | c/c++ | c64 | calc | comics | convert | cube | del.icio.us | digg | east | eBooks | egeszseg | elite | firefox | flash | fun | games | gimp | google | groovy | hardware | hit&run | howto | java | javascript | knife | lang | latex | liferay | linux | lovecraft | magyar | maths | movies | music | p2p | perl | pdf | photoshop | php | pmwiki | prog | python | radio | recept | rts | scala | scene | sci-fi | scripting | security | shell | space | súlyos | telephone | torrente | translate | ubuntu | vim | wallpapers | webutils | wikis | windows Blogs and Dev. * Ubuntu Incident Places Debrecen | France | Hungary | Montreal | Nancy Notes Hobby Projects * Jabba's Codes Quick Links [ edit ] |