請考慮以下幾點:命令的grep輸出有時會起作用..有時候不行?
$ cd ~/.emacs.d/lisp/tabbar
$ git pull
Already up-to-date.
$ git pull | grep -q "Already" ; echo $?
0
我
還是?現在:
$ cd ~/src/emacs-tmp/trunk
$ bzr up
Tree is up to date at revision 108837 of branch /home/px/src/emacs-tmp/trunk
$ bzr up | grep -q "Tree" ; echo $?
Tree is up to date at revision 108837 of branch /home/px/src/emacs-tmp/trunk
1
問題:
- 爲什麼grep的返回碼 「0」(發現)在第一種情況下和 「1」(未找到)在第二個?
- 爲什麼輸入的第一個(git pull)命令是 ?