下面的shell用于在linux下测试文件的相关特性。记录如下,以备查阅.
用法 功能
-b file True if file exists and is a block special file.
-c file True if file exists and is a character special file.
-d file True if file exists and is a directory.
-e file True if file exists.
-f file True if file exists and is a regular file.
-g file True if file exists and has its SGID bit set.
-h file True if file exists and is a symbolic link.
-k file True if file exists and has its “sticky” bit set.
-p file True if file exists and is a named pipe.
-r file True if file exists and is readable.
-s file True if file exists and has a size greater than zero.
-u file True if file exists and has its SUID bit set.
-w file True if file exists and is writable.
-x file True if file exists and is executable.
-O file True if file exists and is owned by the effective user ID.
本站原创文章,转载请注明出处。