Bash [[ ... ]] Operators: Files

Jul 19th, 2020 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. TEST Operators: Files
  3. Operator Tests Whether
  4. -e File exists
  5. -f File is a regular file
  6. -d File is a directory
  7. -h File is a symbolic link
  8. -L File is a symbolic link
  9. -b File is a block device
  10. -c File is a character device
  11. -p File is a pipe
  12. -S File is a socket
  13. -t File is associated with a terminal
  14. -N File modified since it was last read
  15. -O You own the file
  16. -G Group id of file same as yours
  17. -s File is not zero size
  18. -r File has read permission
  19. -w File has write permission
  20. -x File has execute permission
  21. -g sgid flag set
  22. -u suid flag set
  23. -k "sticky bit" set
  24. F1 -nt F2 File F1 is newer than F2 *
  25. F1 -ot F2 File F1 is older than F2 *
  26. F1 -ef F2 Files F1 and F2 are hard links to the same file *
  28. * Binary operator (requires two operands).
  29. ! NOT (inverts sense of above tests)
Add Comment
Please, Sign In to add comment