Permissions

fs_permissions

Get the octal permission mode and path for a file or directory. Tries GNU stat, then BSD stat, then falls back to perl.

Example

fs_permissions /etc/passwd   # => 644 /etc/passwd

Arguments

  • $1 (string): Path to the target file or directory

Exit codes

  • 0: Success
  • 1: File not found (from perl fallback)

Output on stdout

  • Octal mode and path separated by a space