please consider the following:
$ cd ~/.emacs.d/lisp/tabbar
$ git pull
Already up-to-date.
$ git pull | grep -q "Already" ; echo $?
0
Still with me? Now:
$ 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
Questions :
- Why is the return code of grep “0” (found) in the 1st case and
“1” (not found) in the 2nd ? - Why is the output of the first (git pull) command
hidden when grepping for it ?
Looks like bzr is outputting to the standard error device (
/dev/stderr), whilegrepis only inspecting the standard input. You can confirm or deny this guess by trying to redirectstderrtostdin: