Syntax error =~ operator in msysgit bash
I'm trying to add a function to my bash_profile for msysgit : function git-unpushed { brinfo=$(git branch -v | grep git-branch-name) if [[ $brinfo =~ ("[ahead "([[:digit:]]*)]) ]] then echo "(${BASH_REMATCH[2]})" fi } But I get the following error: bash: conditional binary operator expected` bash: syntax error near =~' From what I can find, the "equals tilde" operator ( =~ ) evaluates as regex in bash. Why is =~ is throwing an error? UPDATE: Here's a screenshot of inputting it manually (this is running sh.exe): VonC Update 2015: msysgit is now obsolete. You should use the bash which comes with