我想在我的awk代碼中將mystatus shell變量更新爲新值。 但我猜的語法是不正確的,也 我曾嘗試申報或EVAL,但沒有任何工程 您好,請幫我這個更改AWK條件塊內的Shell腳本變量值
我的代碼:
mystatus="resolved" -- shell variable
awk 'BEGIN { print "<table>" } -- awk code to write in new file
{
print "<tr><td>" $1 "</td><td>" $2 "</td><tr>"
if ($1=="stopped") mystatus="problem" -- change shell variable value
}
END { print "</table>" }' filestats.txt > email.html
echo $mystatus -- variabe value not getting changed.
你不能以這種方式更改shell變量。將其寫入awk中的文件並將其讀取到shell中的變量中。 –