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?
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) { ... }