Advertisement
HexisNou

bash test options

Jan 18th, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. File test operators
  2. The test command includes the following FILE operators that allow you to test for particular types of files:
  3.  
  4. -b FILE - True if the FILE exists and is a special block file.
  5. -c FILE - True if the FILE exists and is a special character file.
  6. -d FILE - True if the FILE exists and is a directory.
  7. -e FILE - True if the FILE exists and is a file, regardless of type (node, directory, socket, etc.).
  8. -f FILE - True if the FILE exists and is a regular file (not a directory or device).
  9. -G FILE - True if the FILE exists and has the same group as the user running the command.
  10. -h FILE - True if the FILE exists and is a symbolic link.
  11. -g FILE - True if the FILE exists and has set-group-id (sgid) flag set.
  12. -k FILE - True if the FILE exists and has a sticky bit flag set.
  13. -L FILE - True if the FILE exists and is a symbolic link.
  14. -O FILE - True if the FILE exists and is owned by the user running the command.
  15. -p FILE - True if the FILE exists and is a pipe.
  16. -r FILE - True if the FILE exists and is readable.
  17. -S FILE - True if the FILE exists and is a socket.
  18. -s FILE - True if the FILE exists and has nonzero size.
  19. -u FILE - True if the FILE exists, and set-user-id (suid) flag is set.
  20. -w FILE - True if the FILE exists and is writable.
  21. -x FILE - True if the FILE exists and is executable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement