$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