I have been working on a problem and I am looking for some insight. I am using perl to check File Permissions on a UNIX Filesystem using stat, however I need to determine if a file is '0755' or less permissive such as '0644'. Thus if I have a file that is either 0750, 0751, 0754, or 0755, my check would succeed, but 0756, 0757, or 0752 (since the write bit is on for those conditions) which would fail. (This has to be done for user, group and world permissions, which makes it more complicated). My other problem was that I could not install any modules since the script will reside of numerous UNIX boxes. My thought has been to convert each digit to a binary number and do a series of comparsions, as strings, such as comparing the binary number of 5: (101) to 4: (100) which should succeed. I thought about binary comparisons, however that doesn't seem to get me the information that I need (ie XOR, AND, etc). If anyone has some insight to my problem, it would be greatly appreciated.
In reply to UNIX File Permissions equal or less than conditions by Themis74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |