diff options
| author | Arnaud Bailly <arnaud.bailly@symbiont.io> | 2019-09-07 10:26:31 +0200 |
|---|---|---|
| committer | Arnaud Bailly <arnaud.bailly@symbiont.io> | 2019-09-07 10:26:31 +0200 |
| commit | 004a6f0c0609d46c96578a8e979493c5c50c02fe (patch) | |
| tree | 4da3d3ba835b7a8e0b1c90b95347c418c69c3a0b | |
| parent | c053a7873d916372f08d96db4a6bc0edffcb0ea2 (diff) | |
| download | dotfiles-004a6f0c0609d46c96578a8e979493c5c50c02fe.tar.gz | |
update bash for ssh agent
| -rw-r--r-- | .bash_profile | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/.bash_profile b/.bash_profile index 959da38..7381c73 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,2 +1,31 @@ -export EDITOR=vim -export PATH=$HOME/.local/bin:$HOME/.cabal/bin:$PATH +export PATH=/Applications/Emacs.app/Contents/MacOS/:/Applications/Emacs.app/Contents/MacOS/bin:${PATH} +export PATH=${HOME}/.local/bin:${PATH} +export PATH=${HOME}/.idris2/bin:${PATH} +export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" +export GOPATH=${HOME}/go +alias ec="emacsclient -c" +alias g=git + +# from https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login +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; +} + +# 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 |
