$basename()

DESCRIPTION
    returns a filepath's terminating filename, without any directory portion
SYNOPSIS
    $basename(s)
ARGUMENTS
    s - a quoted string, or string expression, representing a filepath
EXAMPLES
# pikt +C 'output $basename("/usr/local/bin/snmpget")'
snmpget
        init
                ...
                input proc "=find /usr/local/share/man"
                dat $filepath 1

        rule
                set $file = $basename($filepath)
PiktFileProblemsWarning

        init
                status active
                level warning
                task "Report file deviations on normally static PIKT files"
                input proc "=cat =filespiktetc_obj"
                dat $name 1

        rule
                set $basnam = $basename($name)

        ...

        rule    // if changed, and if we have backup of the previous file
                // diff the current against the previous
                if #changed
                        if -e "=hstdir/$basnam"
                                output mail "=diff =hstdir/$basnam $name"
                                =outputproc(mail, "=diff =hstdir/$basnam $name")
                                output mail =newline
                        endif
                endif
SEE ALSO
    $dirname()

    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
root
core file
Pikt script