Last active
February 7, 2016 20:03
-
-
Save alanmquach/ebcc8eb55fcf2664d56f to your computer and use it in GitHub Desktop.
Bootstrap Mac shell with my bash prompt and git tab completion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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