Binary XOR and AND are the answers I would have expected to give, yet you state they don't give the info you need.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.