insert_licence_demos.pl

来自「时频分析的工具包」· PL 代码 · 共 64 行

PL
64
字号
#!/bin/perluse strict;my $tftb_root = "demos";@ARGV = "$tftb_root";my $dir = $ARGV[0];ListRep($dir);sub ListRep {     my ($dir) = @_;     if (! -e $dir ) {     print "Unknown directory ($dir).";     return undef;     }        if (! -d $dir ) {     print "$dir is not a directory";     return undef;     }             if (! opendir( DIR, $dir) ) {     print "Impossible to open the directory $dir : $!.";     return undef;     }          my @files = grep !/(?:^\.$)|(?:^\.\.$)/, readdir DIR;     closedir DIR;           print "\nFiles contained\n";     foreach(@files) {        print $_."\n";        if ($_ =~ /\.m$/i) 	{ 			my $line;						open (TEMP, ">>$tftb_root/temp.log") || die "impossible to open temp.log";		open (ENTETE, "< licence") || die "impossible to open entete";		while (my $line = <ENTETE>)	   	{			print TEMP "$line";	   	}	     	close (ENTETE);						open (FILE, "<$tftb_root/$_") || die "impossible to open $_.";		while (my $line = <FILE>)            	{			print TEMP "$line";			}		  			close (FILE);		close (TEMP);						`rm $tftb_root/$_`;		`mv $tftb_root/temp.log $tftb_root/$_`;						}    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?