From 110264439bdd4ccf4f2f3487dbd6eb873477a68e Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Sat, 17 Jan 2026 17:51:55 +0100 Subject: Refactor .bash_profile to be more resilient/OS-specific --- .bash_profile | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to '.bash_profile') diff --git a/.bash_profile b/.bash_profile index 94e087b..0b87148 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,7 +1,23 @@ -#!/bin/bash -# shellcheck disable=SC1091 +#!/bin/bash +# shellcheck disable=SC1091 # Disables file doesn't exist warning +# macOS specific +if [[ "$OSTYPE" == darwin* ]]; then + # Homebrew Apple M1/Intel fixing of $PATH and loading bash_completion + if [ -d /opt/homebrew ]; then + eval "$(/opt/homebrew/bin/brew shellenv)" + source "/opt/homebrew/etc/bash_completion" + elif [ -d /usr/local/Homebrew ]; then + eval "$(/usr/local/Homebrew/bin/brew shellenv)" + source "/usr/local/Homebrew/etc/bash_completion" + fi + # Custom colors (not LS_COLORS as unix) defaultscheme "exfxcxdxbxegedabagacad" + export LSCOLORS=gxfxcxdxbxegedabagacad + # Silence new macOS warning about bash + export BASH_SILENCE_DEPRECATION_WARNING=1 +fi + if [ -f "$HOME/.profile" ]; then source "$HOME/.profile" fi @@ -10,17 +26,3 @@ fi if [ -f "$HOME/.bashrc" ]; then source "$HOME/.bashrc" fi - -# Homebrew Apple M1/Intel fixing of $PATH and loading bash_completion -if [ -d /opt/homebrew ]; then - eval "$(/opt/homebrew/bin/brew shellenv)" - source "/opt/homebrew/etc/bash_completion" -elif [ -d /usr/local/Homebrew ]; then - eval "$(/usr/local/Homebrew/bin/brew shellenv)" - source "/usr/local/Homebrew/etc/bash_completion" -fi - -# Mac OS custorm colors (not LS_COLORS as unix) defaultscheme "exfxcxdxbxegedabagacad" -export LSCOLORS=gxfxcxdxbxegedabagacad -# Silence new macOS warning about bash -export BASH_SILENCE_DEPRECATION_WARNING=1 -- cgit v1.2.3