Perl File Test Operator Rollup _ Basics Tutorial

Source: Internet
Author: User
Tags bit set readable

First article:

Copy Code code as follows:

operator meaning
-r file or directory readable
-w file or directory writable
-x file or directory execution
-o file or directory owned by user
-r file or directory to true user readable
-W file or directory to true user writable
-x file or directory for real user execution
-o file or directory is owned by the true user
-e file or directory exists
-Z file exists and has a size of 0
-s file or directory exists and is not 0 (number of bytes returned)
-l file for symbolic link
-f file as normal file
-D File as Directory
-p file is named pipe (FIFO)
-B file is a block special file
-S file is a socket (socket)
-C file for character special files
-T opens the file handle for the TTY console
-u file or directory is set user ID number
-G file or directory is set user group ID number
-K the sticky position of a file or directory
-T file is a text file
-B file is a binary file
-M presence time in days
-A days-per-day access time
-C changes time in days with code


Second article:

Copy Code code as follows:

-r: The file or directory is readable for this (valid) user (effective user) or group
-W: File or directory is writable for this (valid) user or group
-X: The file or directory is executable for this (valid) user or group
-O: Files or directories are owned by this (valid) user
-r: File or directory is readable for this user (real user) or group
-W: File or directory is writable for this user or group
-x: File or directory is executable for this user or group
-O: The file or directory is owned by this user
-E: File or directory name exists
-Z: File exists with size 0 (directory is false)
-S: File or directory exists, size greater than 0 (value is file size, units: bytes)
-F: Plain text
-D: For directory
-L: For Symbolic Links
-S: Pipe for Socket-p (Entry is a named pipe (a "FIFO")
-B: For block-special files (such as mounting disks)
-C: For character-special files (such as I/O devices)
-u:setuid Files or directories
-g:setgid Files or directories
-k:file or directory has the sticky bit set
-T: The file handle is TTY (the return result of the system function Isatty (); This test cannot be used on the file name)
-T: Files are somewhat like "text" files
-B: Files are somewhat like binary files
-M: Time modified (in: Days)
-A: Time to access (in days)
-C: Index node modification time (in days)

The third article:

Operator

Meaning

-R

The file can be read by a valid uid/gid.

-W

The file can be written by a valid uid/gid.

-X

The file can be executed by a valid uid/gid.

-O

File is valid UID all

-R

The file can be read by the real Uid/gid.

-W

Files can be written by real Uid/gid.

-X

The file can be executed by the real uid/gid.

-O

File is the true UID all

-E

File exists

-Z

File size is zero

-S

File size is not 0 (return size)

-F

File is a simple file

-D

File is a directory

-L

File is a symbolic connection

-P

The file is a named pipe (FIFO).

-S

File is a socket

-B

File is a special block file

-C

File is a special character file

-T

File handle opened for a TTY

-U

The file set the setuid bit

-G

The file set the Setgid bit

-K

The file set the sticky bit

-T

File is a text file

-B

The file is a binary file (corresponds to-t)

-M

Ages since the date of modification (from the beginning)

-A

Age of the document since the last visit (from the beginning)

-C

Age of the document since the change of inode (from the beginning)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.