Skip to content

Instantly share code, notes, and snippets.

@alanmquach
Last active February 7, 2016 20:03
Show Gist options
  • Select an option

  • Save alanmquach/ebcc8eb55fcf2664d56f to your computer and use it in GitHub Desktop.

Select an option

Save alanmquach/ebcc8eb55fcf2664d56f to your computer and use it in GitHub Desktop.
Bootstrap Mac shell with my bash prompt and git tab completion
echo "Downloading tab completion to ~/.tab_completion_git"
curl -s "https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" > ~/.tab_completion_git
echo "Downloading bash prompt to ~/.bash_prompt"
curl -s "https://gist.githubusercontent.com/alanmquach/31d9088cf7f4126c59d1/raw/5ce769a35513a98997e5dda32b259e9ac3ece0a1/.bash_prompt" > ~/.bash_prompt
echo "Adding .tab_completion_git, .bash_prompt to .bash_profile"
echo 'for file in ~/.{tab_completion_git,bash_prompt}; do [ -r "$file" ] && [ -f "$file" ] && source "$file"; done' >> ~/.bash_profile
echo 'export BASH_PROFILE_SOURCED=true' >> ~/.bash_profile
if [ -s ~/.bashrc ]; then
source ~/.bashrc
if [ ! "${BASH_PROFILE_SOURCED}" == "true" ]; then
echo "Adding .bash_profile to .bashrc"
echo '[ -s ~/.bash_profile ] && source ~/.bash_profile' >> .bashrc
else
echo "Looks like .bashrc already sources .bash_profile"
fi
else
echo "Adding .bash_profile from .bashrc"
echo '[ -s ~/.bash_profile ] && source ~/.bash_profile' >> .bashrc
fi
echo "All done! New terminal sessions will have a git prompt and git tab completion."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment