|
藍森林 http://www.lslnet.com 2006年6月26日 11:18
請教高手, 禁止結果輸出屏幕的問題, 2>/dev/null ?
請教高手, 禁止結果輸出屏幕的問題, 2>/dev/null ?
在linux環境下,例如執行命令,會有結果輸出到屏幕.
# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
如果不想要結果輸出,該加什麼參數呀?
/etc/init.d/httpd restart 2>/dev/null好像不行
先謝謝了 |
1>/dev/null
&>/dev/null |
試過對了,TKS yjh777
試過對了,TKS yjh777 |
還是有問題 敲reboot命令後屏幕有輸出顯示,why?
還是有問題 敲reboot命令後屏幕有輸出顯示,why?
reboot 1>/dev/null
reboot &>/dev/null
有沒有辦法屏蔽? 謝謝 |
-->
那些信息很礙眼嗎? 敲完reboot 先關顯示器再回車,這樣就看不到了。
如果你什麼情況下都不想看到那些消息,給你個思路:就把/etc/rc.d/init.d 下的functions 裡
有echo 的地方全刪掉。(類red hat系列linux下。其他分發版和unix可能在不同的文件裡)
只是思路,你要仔細看看到底那些函數負責打印那些消息的? |
# /etc/init.d/httpd restart >/dev/null 2>&1 |
| |