Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'might want to try perl' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
might want to try perl
Authored by: b17bmbr on Dec 28, '03 03:24:44AM

i would recommend perl. for instance:

#!/usr/bin/perl

opendir LIST, "/Users";

@list=readdir LIST;

print "Enter filename\n";
$file=<>;
chomp($file);

print "enter directory\n";
$direct=<>;
chomp($direct);


chmod 0755, $file;

foreach(@list){
link $file, "/Users/".$_.$direct;
}


now, you can add a default directory, etc. i think you'll find perl a much better solution. not that i'm opposed to bash. but, let's say you want to do something like having a file updated or better yet, it is probably better, if yo have wirte access, to write a new file, especialy if it's text. take the above script and do this: (of course this assumes yo have write access to all those directories)

#!/usr/bin/perl

opendir LIST, "/Users";

@list=readdir LIST;

print "Enter filename\n";
$file=<>;
chomp($file);

print "enter directory\n";
$direct=<>;
chomp($direct);

open MSG, "/Users/user1/file.txt");
@msg=<MSG>;
close MSG;

foreach(@list){
open NEWMSG, "/Users/".$_.$direct;
print NEWMSG @msg;
close NEWMSG;
}


just a thought.



[ Reply to This | # ]