linux - invoking function and command using awk -
linux - invoking function and command using awk -
hi script works fine, calls function when there cronjob running under root
usage () { # print usage echo "usage function" } # export -f usage ps -ef | awk '{if ($0 ~ /crond/ && $1 == "root") {system("/usr/bin/env bash -c usage") }}'
however, in add-on calling function print $2 or phone call sec command. cannot syntax right. can help please. in short, how run multiple commands when status met? in illustration above, in add-on running usage() function run sec function , print $2 ( process id ). thanking in advance
try running multiple commands separated semicolon
for illustration :
ps -ef | awk '{if ($0 ~ /crond/ && $1 == "root") {system("/usr/bin/env bash -c usage"); system("/usr/bin/env bash -c func2"); print $2 }}'
linux bash function awk
Comments
Post a Comment