Skip to content

Instantly share code, notes, and snippets.

@graugans
Last active March 25, 2017 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graugans/e77edec7a955626294c4e73fe3a09982 to your computer and use it in GitHub Desktop.
Save graugans/e77edec7a955626294c4e73fe3a09982 to your computer and use it in GitHub Desktop.
User defined extension to the ~/.bashrc
# ----- ~/.bashrc_user ----------------------------------------------------------------------------
# This is my user defined ~/.bashrc to use it you need to add somesthing like this to
# your regular bashrc
#
# # User defined bashrc
# # You may want to put all your additions into a separate file like
# # ~/.bashrc_user
#
# if [ -f ~/.bashrc_user ]; then
# . ~/.bashrc_user
# fi
#
# enforce the same locale setting (Englisch messages, A4 paper size,
# UTF-8 and euro sign, date/number/etc formating, ...)
export LNAG=en_IE@utf-8
# Force vim as EDITOR
export EDITOR=vim
# For Mac users
#alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
# Get some fancy prompt with current git branch
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \[\033[0;36m\]\h \w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] ▶\[\033[0m\] '
# Autoload SSH keys into the ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
# Modify this this to fit your key names
/usr/bin/ssh-add ~/.ssh/id_rsa;
/usr/bin/ssh-add ~/.ssh/id_rsa-ge;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment