Skip to content

Instantly share code, notes, and snippets.

@truetamtam
Last active October 16, 2015 11:12
Show Gist options
  • Select an option

  • Save truetamtam/71e5e7f79835ccc10378 to your computer and use it in GitHub Desktop.

Select an option

Save truetamtam/71e5e7f79835ccc10378 to your computer and use it in GitHub Desktop.
My .bashrc
# truetamtam
# PS1 for debian set in /etc/bash.bashrc
# PS1='${debian_chroot:+($debian_chroot)}\[\e[1;32m\][\u@\h: \w]\$\[\e[0m\] '
# vim options set in /etc/vim/vimrc
alias vg='vagrant'
alias hs='homestead'
alias cm='composer'
alias dc='docker-compose'
alias d='docker'
alias dm='docker-machine'
alias l='ls -al'
alias ..='cd ../'
alias ...='cd ../..'
alias ~='cd ~'
# start the ssh-agent
# GITHUB script start
#
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
if [ "$SSH_AUTH_SOCK" ]; then
# ssh-add returns:
# 0 = agent running, has keys
# 1 = agent running, no keys
# 2 = agent not running
ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]
else
false
fi
}
agent_has_keys() {
ssh-add -l >/dev/null 2>&1
}
agent_load_env() {
. "$env" >/dev/null
}
agent_start() {
(umask 077; ssh-agent >"$env")
. "$env" >/dev/null
}
if ! agent_is_running; then
agent_load_env
fi
# if your keys are not stored in ~/.ssh/id_rsa or ~/.ssh/id_dsa, you'll need
# to paste the proper path after ssh-add
if ! agent_is_running; then
agent_start
ssh-add
ssh-add ~/.ssh/id_vdsina
ssh-add ~/.ssh/id_homestead
elif ! agent_has_keys; then
ssh-add
ssh-add ~/.ssh/id_vdsina
ssh-add ~/.ssh/id_homestead
fi
unset env
# /GITHUB script end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment