我有一个Perl脚本,它将文件名作为输入..如何将其转换为Shell脚本?请帮我
$path = shift;
$path =~ /.*\/(.*)/;
$filename = $1;
if (0 == length($filename)) {
$filename = $path;
}
$rev = `git log -- $path | head -n 3`;
$rev =~ /^Date:\s*(.*)\s*$/m;
$date = $1;
while (<STDIN>) {
s/\$Date[^\$]*\$/\$Date: $date \$/;
s/\$Revision[^\$]*\$/\$Revision: $ident \$/;
} continue {
print or die "-p destination: $!\n";
}
The following
sh
command/script will do the same thing as the provided Perl program: