I am using git in mac. I am trying to have the autocomplete feature. I followed these steps (http://www.codethatmatters.com/2010/01/git-autocomplete-in-mac-os-x/) but I get this
Was getting .git-completion.bash: bash: bad interpreter: No such file or directory in Mountain Lion.
Should be "source ~/.git-completion.bash" in ~/.bash_profile
I had tried to use curl -O but the url was wrong and I ended up copying the text which caused the error.
Using this command made it work perfectly:
curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
Thanks a lot everyone for your help!
From your error report:
case "$COMP_WORDBREAK'" in
^ the problem is in unpaired apostrophe
save the file e.g. in gedit with Linux Line-Ending
The git-completion.bash distributed is a Windows file with "\n\r" as a newline. You need to remove the '\r'.
For vim users, just do ":set ff=unix".
Since nobody's answering, quick sanity check: What does bash --version
say? OS X tends to ship slightly outdated bashes, so if your system is old, it might be a compatibility thing. I'd expect that Bash 3.x works fine, but with 2.x I'm not so sure.