diff options
author | Franck Cuny <franckcuny@gmail.com> | 2016-07-15 10:19:31 -0700 |
---|---|---|
committer | Franck Cuny <franckcuny@gmail.com> | 2016-07-15 10:19:31 -0700 |
commit | b909e4f691d23d5c65bb5d7107390fe393a95c11 (patch) | |
tree | 9071261df3a36eb9b986b34f5e321fb0b2c41c3f | |
parent | [git] don't use colors and remove a couple aliases (diff) | |
download | emacs.d-b909e4f691d23d5c65bb5d7107390fe393a95c11.tar.gz |
[bash] don't build the PATH blindly
Check if directories / files exist before adding them to the path or sourcing them.
Diffstat (limited to '')
-rw-r--r-- | bashrc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/bashrc b/bashrc index c80a18d..b48f69b 100644 --- a/bashrc +++ b/bashrc @@ -7,10 +7,10 @@ export PAGER="less" export TZ=America/Los_Angeles export GOPATH="${HOME}/gocode" -export PATH="${GOPATH}/bin:${HOME}/bin:/opt/twitter/opt/go/libexec/bin:${PATH}" - [ -z "$PS1" ] && return +[ "${BASH_VERSINFO}" -gt 3 ] && shopt -s autocd + # prompts export PS1="\W % " @@ -25,18 +25,27 @@ alias lt="ls -lhtr" alias mv="mv -i" alias rm="rm -i" -alias utc="date -u" -alias k="kubectl" -alias camera-backup="pbackup --bucket fcuny-photos --project fcuny-backups --import-path /Volumes/a6000/DCIM/100MSDCF/" - +alias au="aurora" alias g="git" -alias gclean="git clean -dfx" +alias k="kubectl" +alias camera-backup="pbackup --bucket fcuny-photos --project fcuny-backups --import-path /Volumes/a6000/DCIM/100MSDCF/" alias docker-restart="docker-machine restart default" - alias get-transactions="transactions --dataset fcuny_finance_transactions --project fcuny-devel" +alias gobknest="ssh -K bookkeeper@nest.smfc.twitter.com" +alias goebnest="ssh -K eventbus@nest.smfc.twitter.com" +alias gonest="ssh -K nest.smfc.twitter.com" + +# finally, build the path +[ -d "${HOME}/bin" ] && PATH="${HOME}/bin:${PATH}" +[ -d "${GOPATH}/bin" ] && PATH="${GOPATH}/bin:${PATH}" +[ -d "${HOME}/src/source/dist" ] && PATH="${HOME}/src/source/dist:${PATH}" [ -f "${HOME}/google-cloud-sdk/path.bash.inc" ] && source "${HOME}/google-cloud-sdk/path.bash.inc" [ -f "${HOME}/google-cloud-sdk/completion.bash.inc" ] && source "${HOME}/google-cloud-sdk/completion.bash.inc" -[ -f "${HOME}/.bash_local" ] && source "${HOME}/.bash_local" +[ -d "/opt/twitter/opt/go/libexec/bin" ] && PATH="/opt/twitter/opt/go/libexec/bin:${PATH}" +[ -d "/opt/twitter/bin" ] && PATH="/opt/twitter/bin:${PATH}" +[ -f /opt/twitter/rvm/scripts/rvm ] && source /opt/twitter/rvm/scripts/rvm + + |