当前位置: 首页 > 工具软件 > xzs-wechat > 使用案例 >

perl中 -e, -z, -s, -M, -A, -C, -r, -w, -x, -o, -f, -d , -l 含义

元望
2023-12-01

Description taken from the official documentation of Perl:

  • -r File is readable by effective uid/gid.
  • -w File is writable by effective uid/gid.
  • -x File is executable by effective uid/gid.
  • -o File is owned by effective uid.
  • -R File is readable by real uid/gid.
  • -W File is writable by real uid/gid.
  • -X File is executable by real uid/gid.
  • -O File is owned by real uid.
  • -e File exists. #文件是否存在
  • -z File has zero size (is empty).
  • -s File has nonzero size (returns size in bytes).#判断文件是否为空文件

#举个列子,-s使用,

#ef.pl

#! /usr/bin/perl

if ( -s "./file.test" ){#file.test为空文件

print "No zero size continue!\n";

}else{print "Zero size poweroff!\n";

}

perl ef.pl

Zero size poweroff!

  • -f File is a plain file.
  • -d File is a
 类似资料: