我有一个简单的 if 循环,它在一台服务器上运行但在另一台服务器上运行。我可以在 myscript.log 日志文件中查找单词。
#!/bin/ksh
./myscript.sh install $2 $3 $4
sleep 5
if grep -q SUCCESSFUL myscript.log
then
echo "Install is good"
else
echo "Error occured during Install"
fi
输出:
if: Expression Syntax.
脚本外的 Grep:
mymachine:~>grep SUCCESSFUL myscript.log
Install is SUCCESSFUL