From 2d26f20efd2b75d448bd5adca2f6bde1f6d5a33c Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Sun, 28 Jul 2024 12:37:51 +0300 Subject: [PATCH] Explicit is better than implicit --- etc/profile.d/99-brew.sh | 4 ++-- rc/bashrc | 22 ++++++++++++++-------- rc/zshrc | 22 ++++++++++++++-------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/etc/profile.d/99-brew.sh b/etc/profile.d/99-brew.sh index 963f7299..d6a49296 100644 --- a/etc/profile.d/99-brew.sh +++ b/etc/profile.d/99-brew.sh @@ -1,6 +1,6 @@ # https://github.com/Homebrew/brew if [ -d /home/linuxbrew/.linuxbrew/bin ]; then - eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" fi # https://github.com/nvm-sh/nvm @@ -11,5 +11,5 @@ elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then mkdir -p /home/linuxbrew/.nvm export NVM_DIR=/home/linuxbrew/.nvm . /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh - . /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm +# . /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm fi diff --git a/rc/bashrc b/rc/bashrc index e91c55b5..026398c9 100755 --- a/rc/bashrc +++ b/rc/bashrc @@ -270,13 +270,16 @@ export RES_OPTIONS="timeout:2 attempts:2 rotate edns0 trust-ad" # https://github.com/go-nv/goenv if [ -d ~/.goenv/bin ]; then export GOENV_ROOT="$HOME/.goenv" - PATH="$HOME/.goenv/bin:$PATH" - #goenv init > /dev/null 2>&1 + PATH="$GOENV_ROOT/bin:$PATH" + eval "$(goenv init -)" + PATH="$GOROOT/bin:$PATH" + PATH="$PATH:$GOPATH/bin" +elif [ -d /home/linuxbrew/.linuxbrew/opt/goenv ]; then + export GOENV_ROOT="$/home/linuxbrew/.linuxbrew/opt/goenv" + PATH="$GOENV_ROOT/bin:$PATH" eval "$(goenv init -)" PATH="$GOROOT/bin:$PATH" PATH="$PATH:$GOPATH/bin" -elif hash goenv 2> /dev/null; then - eval $(goenv init -) fi # https://github.com/nvm-sh/nvm @@ -287,7 +290,7 @@ elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then mkdir -p /home/linuxbrew/.nvm export NVM_DIR=/home/linuxbrew/.nvm . /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh - . /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm + #. /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm fi # https://github.com/rbenv/rbenv @@ -296,7 +299,8 @@ if [ -d ~/.rbenv/bin ]; then eval "$(rbenv init -)" # Remember! And verify it before running! # git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build -elif hash rbenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/rbenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/rbenv/bin:/home/linuxbrew/.linuxbrew/opt/rbenv/bin/shims:$PATH" eval "$(rbenv init -)" fi @@ -312,7 +316,8 @@ if [ -d ~/.pyenv/bin ]; then # Worth considering (and verifying before running) # git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv # git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper -elif hash pyenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/pyenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/pyenv/bin:/home/linuxbrew/.linuxbrew/opt/pyenv/shims:$PATH" eval "$(pyenv init -)" fi @@ -322,7 +327,8 @@ if [ -d ~/.nodenv/bin ]; then eval "$(nodenv init -)" # Remember! And verify it before running! # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build -elif hash nodenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/nodenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/nodenv/bin:$PATH" eval "$(nodenv init -)" fi diff --git a/rc/zshrc b/rc/zshrc index e1463ca4..03cbf9f7 100755 --- a/rc/zshrc +++ b/rc/zshrc @@ -224,13 +224,16 @@ export RES_OPTIONS="timeout:2 attempts:2 rotate edns0 trust-ad" # https://github.com/go-nv/goenv if [ -d ~/.goenv/bin ]; then export GOENV_ROOT="$HOME/.goenv" - PATH="$HOME/.goenv/bin:$PATH" - #goenv init > /dev/null 2>&1 + PATH="$GOENV_ROOT/bin:$PATH" + eval "$(goenv init -)" + PATH="$GOROOT/bin:$PATH" + PATH="$PATH:$GOPATH/bin" +elif [ -d /home/linuxbrew/.linuxbrew/opt/goenv ]; then + export GOENV_ROOT="$/home/linuxbrew/.linuxbrew/opt/goenv" + PATH="$GOENV_ROOT/bin:$PATH" eval "$(goenv init -)" PATH="$GOROOT/bin:$PATH" PATH="$PATH:$GOPATH/bin" -elif hash goenv 2> /dev/null; then - eval $(goenv init -) fi # https://github.com/nvm-sh/nvm @@ -241,7 +244,7 @@ elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then mkdir -p /home/linuxbrew/.nvm export NVM_DIR=/home/linuxbrew/.nvm . /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh - . /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm + #. /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm fi # https://github.com/rbenv/rbenv @@ -250,7 +253,8 @@ if [ -d ~/.rbenv/bin ]; then eval "$(rbenv init -)" # Remember! And verify it before running! # git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build -elif hash rbenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/rbenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/rbenv/bin:/home/linuxbrew/.linuxbrew/opt/rbenv/bin/shims:$PATH" eval "$(rbenv init -)" fi @@ -266,7 +270,8 @@ if [ -d ~/.pyenv/bin ]; then # Worth considering (and verifying before running) # git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv # git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper -elif hash pyenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/pyenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/pyenv/bin:/home/linuxbrew/.linuxbrew/opt/pyenv/shims:$PATH" eval "$(pyenv init -)" fi @@ -276,7 +281,8 @@ if [ -d ~/.nodenv/bin ]; then eval "$(nodenv init -)" # Remember! And verify it before running! # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build -elif hash nodenv 2> /dev/null; then +elif [ -d /home/linuxbrew/.linuxbrew/opt/nodenv/bin ]; then + PATH="/home/linuxbrew/.linuxbrew/opt/nodenv/bin:$PATH" eval "$(nodenv init -)" fi