TTY:终端是一种字符型设备,它有多种类型,通常使用tty 来简称各种类型的终端设备
1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 print "exist!\n" if -e '1.txt'; 7 print "exist!\n" if -e '2.txt'; 8 9 #exist! 10 # 11 12 warn "new file!\n" if -M '1.txt' < 2; 13 14 #new file! 15 16 my $filename = '1.txt'; 17 if((-s $filename <100_000) &&(-A _ < 1)){print "this file is small and new!\n";} 18 if(-w -r _ ){print "this file is both writable and readable!\n";} 19 20 #this file is small and new! 21 #this file is both writable and readable! 22 23 my $file = -s $filename;print "file size is $file"."B\n"; 24 25 #file size is 116B 26 27 if (-l 'check.pl'){print "check.pl is a file with link\n"} 28 29 #check.pl is a file with link 30 31 my $M = -M '1.txt';my $C = -C 'check.pl';my $A = -A 'check.pl';print "$M\t$C\t$A\n"; 32 33 #0.0313657407407407407 3.10847222222222222 3.10847222222222222 34 35 $_ ='1.txt';if (-r){print "$_ is a readhandle\n"} 36 37 #1.txt is a readhandle 38 39 my $size = (-s)/1024;print "$size\n"; 40 41 #0.11328125 42 43 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat('1.txt');$atime = localtime $atime; 44 my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=localtime $ctime; 45 print "dev_number=$dev\ninode =$ino\nmode=$mode\nhard link=$nlink\nuser id=$uid\ngroup id=$gid\n$rdev\nsize=$size\n$atime\n$mtime\n$ctime\n$blksize\n$blocks\n"; 46 print "$yday\n"; 47 48 #dev_number=43 49 #inode =95085688861 50 #mode=33188 51 #hard link=1 52 #user id=1000092 53 #group id=30086 54 #0 55 #size=116 56 #Sun Jun 30 17:17:20 2019 57 #1561886240 58 #1561886240 59 #1048576 60 #8 61 #180 62 63 my $now =gmtime;print "$now\n"; 64 65 #Sun Jun 30 11:10:25 2019 66 67 my $two = 12&2;print "$two\n"; 68 my $move = 25.5>>2;print "$move\n"; 69 $move = (25>>2)<<2;print "$move\n"; 70 71 #0 72 #6 73 #24