Run arbitrary commands when files change
To test a script run manually, run the awk script and type the status
lines using the format
exit_or_signal exit_code utility_name
$ awk -F '|' -f bold.awk exit|0|bash signal|15|bash ^D
{
if ($2 == "0")
print "✔ pass"
else
print "✘ fail"
}
{ }
function bold(s) { return "\033[1;37m"s"\033[0m" } function underline(s) { return "\033[4m"s"\033[0m" } /^signal/ { print underline($3), "terminated by signal", bold($2); } /^exit/ { print underline($3), "returned exit code", bold($2); }
{
if ($2 == "0")
system("tmux set status-style fg=black,bg=green")
else
system("tmux set status-style fg=white,bg=red")
}
Distributions that use busybox, such as Alpine Linux do not have a
secure/sandbox flag for awk. Use
-xx
option or install
gawk.