Search code examples
macosterminalosx-yosemite

git-completion.bash and .bash_profile Erro


I was trying to edit my bash profile and it was a epic fail. I tried to search for an answer online but no luck. Now everytime I open my Terminal this message always appear.

Last login: Tue Jun 30 01:19:29 on ttys000
-bash: /Users/<username>/bin/git-completion.bash: No such file or directory
-bash: /Users/<username>/.bash_profile: line 114: syntax error near unexpected token `('
-bash: /Users/<username>/.bash_profile: line 114: `alias ip1="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"'
<username>-MacBook-Air-2:~ <username>$ 

I basically tried to copy and past this guy's bash profile Bash Profile (the code under "conclusion") and for some reason it didn't work and I googled how to reset the bash profile by copy and past this code on the command line

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH" 
export PATH

Please help. Thanks!

P.S. I am using MacBook Air OSX Yosemite version 10.10.3


Solution

  • The first error is referring to a file he made for custom bash completion of git commands. You can remove that, originally line 6:

    source ~/bin/git-completion.bash
    

    For the second error, there are some unneeded characters in the alias, change line 114 to:

    alias ip1="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"