home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume3
/
perlshar
/
shar.p
Wrap
Text File
|
1989-02-03
|
1KB
|
32 lines
print "#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# ",join("\n#\t",@ARGV),"\n#\n";
while ($arg = shift) {
@dirs = split(/\//,$arg);
for ($i=0; $i < $#dirs; $i++) {
$dir .= $dirs[$i];
if ($dir && !$done{$dir}) {
print "if test ! -d '$dir'\nthen\n\tmkdir '$dir'\nfi\n";
$done{$dir} = 1;
}
$dir .= "/";
}
@stat = stat($arg);
$size = $stat[7];
open(file, $arg);
print "if test -f '$arg'\nthen\n";
print "\techo shar: will not over-write existing file \"'$arg'\"\n";
print "else\n";
print "\techo x - '$arg'\n";
print "\tsed 's/^X//' >'$arg' << 'SHAR_EOF'\n";
while (<file>) { print "X",$_; }
print "SHAR_EOF\n";
print "if test $size -ne \"`wc -c < '$arg'`\"\nthen\n";
print "\techo shar: error transmitting \"'$arg'\" '(should have been $size characters)'\nfi\nfi\n";
}
print "echo Done\nexit 0\n";