【发布时间】:2015-11-12 13:44:02
【问题描述】:
在Amazon Linux 上的init.d 脚本中是否有以下命令静音
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 ]
【问题讨论】:
-
man curl | grep -i -C 2 quiet和man grep | grep -i -C 2 quiet