mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 02:20:11 -08:00
refactor: Improve .profile for shell compatibility and PATH management
This commit is contained in:
@@ -9,10 +9,18 @@
|
|||||||
#umask 022
|
#umask 022
|
||||||
|
|
||||||
# if running bash
|
# if running bash
|
||||||
if [ -n "$BASH_VERSION" ]; then
|
if [ "$SHELL" = "/bin/bash" ]; then
|
||||||
# include .bashrc if it exists
|
# include .bashrc if it exists and we are not in a subshell
|
||||||
|
# Check if .bashrc exists
|
||||||
if [ -f "$HOME/.bashrc" ]; then
|
if [ -f "$HOME/.bashrc" ]; then
|
||||||
. "$HOME/.bashrc"
|
# Check if we are in a login shell (indicated by -l in the shell options)
|
||||||
|
if ! shopt -oq posix; then # Check if not running in POSIX mode (usually implies a login shell)
|
||||||
|
. "$HOME/.bashrc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ "$SHELL" = "/bin/zsh" ]; then
|
||||||
|
if [ -f "$HOME/.zshrc" ]; then
|
||||||
|
. "$HOME/.zshrc"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -26,4 +34,23 @@ if [ -d "$HOME/.local/bin" ] ; then
|
|||||||
PATH="$HOME/.local/bin:$PATH"
|
PATH="$HOME/.local/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nvm use stable
|
# Use stable nvm version if available
|
||||||
|
if command -v nvm &> /dev/null; then
|
||||||
|
nvm use stable
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add Go directories to PATH
|
||||||
|
if [ -d "/usr/local/go/bin" ] ; then
|
||||||
|
PATH="/usr/local/go/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/go/bin" ] ; then
|
||||||
|
PATH="$HOME/go/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add Go version-specific paths if they exist
|
||||||
|
for go_path in /usr/lib/go-*/bin /usr/lib/go/bin; do
|
||||||
|
if [ -d "$go_path" ] ; then
|
||||||
|
PATH="$go_path:$PATH"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user