$filemode()

DESCRIPTION
    for a given path, returns its mode in octal format
SYNOPSIS
    $filemode(s)
ARGUMENTS
    s - a quoted string, or string expression, representing a file or directory path
EXAMPLES
# pikt +C 'output $filemode("/etc")'
040755

# pikt +C 'output $filemode("/etc/shadow")'
100640
        rule
                set $fm = $filemode($inlin)
                if $fm ne "100640"
                        output mail "$inlin mode $fm is incorrect, should be "100640"
                fi
        rule
                set $fm = $filemode($inlin)
                set $modother = $mid($fm,6,1)
                if "762" =~ $modother
                        output mail "$inlin mode is $fm, $inlin is other-writable!"
                fi
        // at this point, any $partitions remaining are candidates for
        // backing up

        rule    // check devfile ownerships and permissions
                set $devfile = =devfile($mount)
#  ifdef debug
                output $devfile
#  endifdef
                if #fileuid($devfile) != 0      // root
                        output "$mount devfile $devfile not root-owned"
                fi
                if #filegid($devfile) != =sysgid
                        output "$mount devfile $devfile not sys-owned"
                fi
                if $filemode($devfile) ne "060640"
                        output "$mount devfile $devfile perms not 060640, are $filemode($devfile)"
                fi
SEE ALSO
    String Functions
    Numerical Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
system patches
Pikt script