How to check if “s” permission bit is set on Linux shell? or Perl?
问题 I am writing some scripts to check if the "s" permission bit is set for a particular file. For example - permissions for my file are as follows- drwxr-s--- How can I check in bash script or a perl script if that s bit is set or not? 回答1: If you're using perl, then have a look at perldoc: -u File has setuid bit set. -g File has setgid bit set. -k File has sticky bit set. So something like: if (-u $filename) { ... } 来源: https://stackoverflow.com/questions/29083434/how-to-check-if-s-permission