From: Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]>
> Is it possible to use a simple perl script to do simple unix commands.
> (similar to the shell scripts)?
>
> For example I want to run a unix command on all files in a current
> directory:
>
> Shell script (just pick dos2unix for example):
>
> Foreach f (*.*)
> Dos2unix $f
> Echo $f . " cleaned"
> Done
Assuming your dos2unix writes the result back to the original file if
given only one parameter (mine does not, mine prints the result to
STDOUT)
use Shell 'dos2unix';
foreach $file (<*.*>) {
dos2unix $file;
print "$file cleaned\n";
}
For mine dos2unix I'd have to use
use Shell 'dos2unix';
foreach $file (<*.*>) {
dos2unix $file, "$file.tmp";
if (-e "$file.tmp") {
unlink $file;
rename "$file.tmp", $file;
}
print "$file cleaned\n";
}
;-)
Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]