$command()

DESCRIPTION
    executes the command string, returning its first line of output only

    (if more than one output line is needed, uses #popen() and #read() instead)
SYNOPSIS
    $command(s)
ARGUMENTS
    s - a quoted string, or string expression, representing a command
EXAMPLES
# pikt +C 'output $command("/usr/bin/last")'
brahms pts/32       laptop-biff.vpn. Mon Jun 18 13:34 - 17:16  (03:41)
        rule
                set $last = $command("=tail -n 1 =piktd_log")
        rule    // bogus group
                if    ( $gid ne "0" )
                   && $command("=grep ':$gid:' /etc/group 2>/dev/null") eq ""
                        output mail "User $user in unknown group ($gid):"
                        output mail "  $inline"
                endif
        rule    // get log file size, in lines for text files, and KB for
                // binary files
                set #size = #if(#binary, #filesize($name)/=KB,
                                #val($command("=wc -l $name | =awk '{print \$1}'")))
                ...
        rule
                set $oidtxt = $command("$snmpcmd | =awk '{print \$1}'")
#ifdef debug
                output $oidtxt
#endifdef
        begin
                set $yymmdd = $command("=date +'\%y\%m\%d'")
                exec wait "=rm =acmelogdir/LogServerLog.current;
                             =ln -s =acmelogdir/LogServerLog.$yymmdd
                                    =acmelogdir/LogServerLog.current"
        begin
                set $yymmdd = $command("=date '+\%y\%m\%d'")
                set $ndbdoutfile = "/tmp/ndbd.out." . $yymmdd . ".*"
                if $command("=ls $ndbdoutfile 2>&1") =~~ "no such file"
                        output mail "missing ndbd.out file!"
                        quit
                fi
                exec wait "=ln -s $ndbdoutfile /tmp/ndbd.out.current 2>/dev/null"
                if $pr ne $command("=psls | =trim(160) | =zapinterpreters |
                                    =tail -n +2 | =awk '{print \$11}' |
                                    =awk -F/ '{print \$NF}' | =sort | =uniq |
                                    =egrep $pr")
SEE ALSO
    #system()

    Numerical Functions
    String 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
changed files
script macro