I have a nice bash/zenity
script that I use to check/update a number of git repos and report the status of each like this - showing only one sample repo here:
zenity --class=CheckGit --info title="Check git updates" --text="\n \
<b>MY-GIT-REPO:</b> $(cd "/home/ME/.local/share/git/MY-GIT-REPO" && git pull | grep -E '(up-to-date|changed)')"
It was working well until I encountered an error due to a change in one of the local files, which resulted in a blank line for that repo.
Terminal output was like this:
error: Your local changes to the following files would be overwritten by merge:
xxx/yyy
Please, commit your changes or stash them before you can merge.
Aborting
So I modified the grep command like this: grep -E '(up-to-date|changed|error)'
to also display such messages. But to my surprise it still refused to show anything.
As a novice in bash scripting I don't understand what is causing this. How come grep displays lines containing the words "up-to-date" or "changed" but not "error"?.. Does this word have a special meaning then? In that case how can I make it display an error message?