反正在init.d
腳本沉默Amazon Linux
的init.d腳本停止回聲管到grep輸出到終端
response=`curl 'http://localhost:9200'`
if (echo "$response" | grep -e "\"status\" : 200"); then
... some logic
此命令和預期條件的作用下面的命令,但是當腳本運行service scriptname start
被打印到控制檯
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 333 100 333 0 0 54278 0 --:--:-- --:--:-- --:--:-- 55500
"status" : 200,
Starting scriptname [ OK ]
理想地,以下如果可能的話,我想顯示,只顯示:
Starting scriptname [ OK ]
使用'捲曲-s ...'' – anubhava
人捲曲事| grep -i -C 2 quiet'和'man grep | grep -i -C 2 quiet' – Cyrus