diff options
Diffstat (limited to '.bash/vars.bash')
| -rw-r--r-- | .bash/vars.bash | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/.bash/vars.bash b/.bash/vars.bash index 773d75d..0bdb5d5 100644 --- a/.bash/vars.bash +++ b/.bash/vars.bash @@ -18,18 +18,28 @@ SSHAGH+=( "woschd.example.com" ) export SSHAGH # ----- SHELL ----- # -for pa in "/usr/local/bin" "${HOME}/bin";do - if ! printf "%b" "$PATH"|grep -P "^${pa}:|:${pa}:" >/dev/null;then - export PATH="${pa}:${PATH}" +for pa in "/usr/local/bin" "${HOME}/bin" "${HOME}/.local/bin" "${HOME}/go/bin";do + if [ -x "$pa" ]; then + if ! printf "%b" "$PATH"|grep -E "^${pa}:|:${pa}:" >/dev/null;then + export PATH="${pa}:${PATH}" + fi fi done # $OSNAME if [ -r "/etc/os-release" ];then - OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1)" + OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + if grep '^DEBIAN_VERSION_FULL' /etc/os-release >/dev/null 2>&1; then + OSVER="$(grep '^DEBIAN_VERSION_FULL' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + elif grep '^BUILD_ID' /etc/os-release >/dev/null 2>&1; then + OSVER="$(grep '^BUILD_ID' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + else + OSVER="$(grep '^VERSION_ID' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + fi +elif [ "$(uname -s)" == 'SunOS' ]; then OSNAME="sunos" elif [ -r "/etc/redhat-release" ];then - grep -P "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat" - grep -P "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora" - grep -P "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos" + grep -E "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat" + grep -E "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora" + grep -E "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos" [ -z "$OSNAME" ]&&OSNAME="obsolete" elif [ -r "/etc/SuSE-release" ];then OSNAME="oldsuse" @@ -70,6 +80,29 @@ if command -v less >/dev/null;then export LESSANSIENDCHARS="m" export LESSANSIMIDCHARS="0123456789:;[?!\"'#%()*+ " fi + +# ----- RUBY ----- # +# Include local gems' binary path from those gems matching /usr/bin/ruby: +if [ -x '/usr/bin/ruby' ]; then + rubymajmin="$(/usr/bin/ruby -e 'print(RUBY_VERSION.gsub(%r{\.[0-9]+$}, '\'\''))')" + rubypath="${HOME}/.gem/ruby/${rubymajmin}.0/bin" + unset rubymajmin + if [ -d "$rubypath" ]; then + if ! printf '%b' "$PATH" | grep -P "(^|:)${rubypath}(:|$)" > /dev/null; then + PATH="${PATH}:$rubypath" + fi + fi +fi + +# ----- RUST ----- # +# Include local crates' binary path: +cargopath="${HOME}/.cargo/bin" +if [ -d "$cargopath" ]; then + if ! printf '%b' "$PATH" | grep -P "(^|:)${cargopath}(:|$)" > /dev/null; then + PATH="${PATH}:$cargopath" + fi +fi + # ----- MISC ----- # # nopaste export NOPASTE_SERVICES='pastebin nopaste' |
