[prog] [Perl] chop URL to get filename
Chris Henderson
henders254 at gmail.com
Mon Apr 30 12:30:00 UTC 2007
Hi,
I'm writing this code to automate the process of building RPMS from
.spec files & also to learn more Perl. I have got to the stage where I
can download (wget) the file (tgz/ tz/ bzip2/ bz2) but now I need to
cp the downloaded file to a specific directory before doing anything
else. And this is where I got stuck. Some help would be appreciated.
Thanks.
#!/usr/bin/perl
use strict;
use warnings;
my $tar='/bin/tar -xzvf';
my $mkdir='/bin/mkdir';
my $rm='rm -rf';
my $cp='/bin/cp';
my $wget='/usr/local/bin/wget';
my $dir='/src/RPMS';
my $fetch_file = $ARGV[0] || &usage;
system ("$wget $fetch_file");
# can't do this
system ("$cp $fetch_file");
sub usage {
print "\n";
print "wgets source files and make RPMs\n\n";
print "Usage: src_install.pl <source package>\n\n";
exit;
}
More information about the Programming
mailing list