Shell determines file type and permissions

Source: Internet
Author: User

The shell determines the file type.

-D file to determine whether the file exists, and whether it is a directory (the directory is true)-e file to determine whether the file exists (exists as true)-F file to determine whether the file exists , and whether it is a file ( Is the normal file is true)

-R
If a file exists, determine if the file has Read permission to have Read permission to return True
-W
If a file exists, determine if the file has write permission to have write permission to return True
-X
If a file exists, determine whether the file has Execute permission to return True

in the shell, the general wording is eg: [Space--e/tmp/index  . Echo "Yes" | | Echo "No"

Next look at the picture

/tmp/test/cut1.txt the file exists in this directory

/tmp/index.php This file does not exist

Look at the picture

1.txt file only read and execute permission to see the results of the graph. (can not distinguish between the user, 3 of the only one of them is true)

Shell determines file type and permissions

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.