我想做一個監控腳本,並在特殊事件的情況下聯繫指定的人,下面的代碼中的第一個egrep
工作正常,但第二個沒有工作,請幫助:grep不工作while循環
while true; do
tail -f /Testing/script/errors | egrep -o --line-buffer "Timeout" >> wch.txt;
cat /Testing/script/contacts.txt|egrep --line-buffer "FB" | cut -f2 -d ":" >> mail.txt;
sleep 5
done
contact.txt:
FB:[email protected] 谷歌:[email protected]
我照你所說的做了如下圖所示,它沒有工作: –
而真 做 tail -f/Testing/script/errors | egrep -o --line-buffer「Timeout」>> wch.txt; grep -line-buffered'FB'/Testing/script/contacts.txt | cut -f2 -d「:」>> mail.txt sleep 5 done –
第一個grep工作正常,但第二個仍然不工作也許它不是grep或什麼? –