Linux SHELL if command Parameter Description

  • Returns true if file exists and -b is the block file
  • -C Returns true if file exists and is a character file
  • When -d pathname exists and is a directory returns true
  • -e When the pathname specified file or directory exists returns true
  • -F returns true if file exists and is a regular file
  • when -g returned by the pathname specified file or directory exists and SGID bit set to true
  • -h When the file exists and is a symbolic link file returns true if this option is not on some older systems
  • -k returns true when the pathname specified by the file or directory exists and set the "sticky" bit
  • -p When the file exists and is returned to the command pipeline true
  • -r readable and returns when specified by the pathname for the file or directory exists true
  • When -s file of file size is greater than 0 returns TRUE
  • -u returns true when the pathname specified by the file or directory exists and the SUID bit
  • -w returns true when there are specified by the pathname and executable file or directory. A directory for its contents to be accessed must be enforceable.
  • -o returns true when specified by the pathname file or directory exists and is a valid user ID quilt current process specified by the user has.

UNIX Shell which compares character writing:

  • -eq equal
  • -ne not equal
  • -gt greater than
  • -lt less than
  • -le less
  • greater than or equal -ge
  • -z empty string
  • = Two characters are equal
  • ! = Two characters ranging
  • -n non-empty string

Reproduced in: https: //www.cnblogs.com/lvsong/archive/2010/07/05/1775657.html

Guess you like

Origin blog.csdn.net/weixin_33805557/article/details/92959224