- -B. returns true if the file exists and is a block file.
- -C: returns true if the file exists and is a character file.
- -D. If pathname exists and is a directory, true is returned.
- -E: returns true if the file or directory specified by pathname exists.
- -F returns true if the file exists and is a regular file
- -G returns true if the file or directory specified by pathname exists and the sgid bit is set.
- -H returns true if the file exists and is a symbolic link file. This option is invalid in some old systems.
- -K. If a file or directory specified by pathname exists and a "Sticky" bit is set, the system returns the true value.
- -P: returns true if the file exists and is a command pipeline.
- -R: returns true if the file or directory specified by pathname exists and is readable.
- -S: returns true if the file size is greater than 0.
- -U returns true if a file or directory specified by pathname exists and SUID is set.
- -W returns true if the file or directory specified by pathname exists and is executable. A directory must be executable for its content access.
- -O returns true if a file or directory specified by pathname exists and the user specified by the valid user ID of the current process is owned by it.
Comparison character writing in Unix shell:
- -EQ equals
- -ne is not equal to
- -GT greater than
- -lt less than
- -Le is less than or equal to
- -Ge is greater than or equal to
- -Z empty string
- = two equal characters
- ! = Two characters different
- -N non-empty string