Skip to content

Instantly share code, notes, and snippets.

@classmember
Created May 9, 2018 15:32
Show Gist options
  • Select an option

  • Save classmember/dc232342ac61971442f191d6d42cf094 to your computer and use it in GitHub Desktop.

Select an option

Save classmember/dc232342ac61971442f191d6d42cf094 to your computer and use it in GitHub Desktop.
file_perms_eq.sh
# function: file_perms_eq
# description: checks first option (filename) to see if the file perms equals the second option (permissions)
# usage example:
# $ if file_perms_eq mail 700
# > then echo 'good'
# > fi
file_perms_eq() { (( $(stat -c "%a" $1) == $2 ));}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment