From 165efeea940e77c48cbc44effce1c0ae08d1c103 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 1 Nov 2016 13:47:29 -0700 Subject: [bash] simplify a little bit more the configuration --- bashrc | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) mode change 100644 => 100755 bashrc diff --git a/bashrc b/bashrc old mode 100644 new mode 100755 index 6b5ccf1..b2c206e --- a/bashrc +++ b/bashrc @@ -12,7 +12,7 @@ export GOPATH="${HOME}/gocode" [ "${BASH_VERSINFO}" -gt 3 ] && shopt -s autocd # prompts -export PS1="[\$(date -u '+%T %D')]\W % " +export PS1="\W % " alias e="$EDITOR" alias et="emacsclient -nw" @@ -25,24 +25,20 @@ alias lt="ls -lhtr" alias mv="mv -i" alias rm="rm -i" -alias au="aurora" -alias g="git" -alias k="kubectl" - -# 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 "/opt/google-cloud-sdk/path.bash.inc" ] && source "/opt/google-cloud-sdk/path.bash.inc" -[ -f "/opt/google-cloud-sdk/completion.bash.inc" ] && source "/opt/google-cloud-sdk/completion.bash.inc" -[ -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 - -md_prev() { - FILE="${1}" - pandoc -f markdown_github \ - -c https://goo.gl/OVmlwT \ - --self-contained "${FILE}" > /tmp/md_prev && open /tmp/md_prev +# finally, build the path and source a few files +__add_to_path_if_exists() { + [ -d "$1" ] && export PATH="$1:$PATH" } + +__source_file_if_exists() { + [ -s "$1" ] && source "$1" +} + +__add_to_path_if_exists "${HOME}/bin" +__add_to_path_if_exists "${GOPATH}/bin" +__add_to_path_if_exists "${HOME}/src/source/dist" +__add_to_path_if_exists "/opt/twitter/opt/go/libexec/bin" +__add_to_path_if_exists "/opt/twitter/bin" + +__source_file_if_exists "/opt/google-cloud-sdk/path.bash.inc" +__source_file_if_exists "/opt/google-cloud-sdk/completion.bash.inc" -- cgit 1.4.1