Perhaps you can explain that. In the meantime:
Update: SuicideJunkie combines both bit checks in the same mask, much more elegant. Apparently marinersk needs coffee. Or sleep.
#!/usr/bin/perl -w use strict; my $MASK_WRITE_GROUP = 0020; my $MASK_WRITE_WORLD = 0002; my @TestData = ( 0644, 0750, 0751, 0754, 0755, # success tests 0756, 0757, 0752, # failure tests ); { foreach my $permissionsMask (@TestData) { printf "Checking %04o - ", $permissionsMask; my $groupWritePermission = ( $permissionsMask & $MASK_WRITE_GR +OUP ); my $worldWritePermission = ( $permissionsMask & $MASK_WRITE_WO +RLD ); if ( $groupWritePermission || $worldWritePermission ) { print "FAIL\n"; } else { print "PASS\n"; } } } exit; __END__ C:\Steve\Dev\PerlMonks\P-2013-09-17@2251-BitMask>bitmask.pl Checking 0644 - PASS Checking 0750 - PASS Checking 0751 - PASS Checking 0754 - PASS Checking 0755 - PASS Checking 0756 - FAIL Checking 0757 - FAIL Checking 0752 - FAIL
In reply to Re: UNIX File Permissions equal or less than conditions
by marinersk
in thread UNIX File Permissions equal or less than conditions
by Themis74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |