[Shell]查看滚动日志;定位关键词

#!/bin/bash

tail -f /home/chaoyuan/shell_script/monitor_log/1.log | while read line

do

echo $line |grep "Server started" > /dev/null

if [ $? -eq 1 ]; then

continue

else

echo -e "\033[32m server start successful \033[0m"

exit 0

fi

done

你可能感兴趣的:(while,shell)