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