diff --git a/bash/.bashrc b/bash/.bashrc index 2ad562d..bd04788 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -97,13 +97,13 @@ function up(){ if [ -z "$d" ]; then d=.. fi - cd $d + cd "$d" || exit } # create an directory and directly cd into it function mcd() { - mkdir -p $1 - cd $1 + mkdir -p "$1" + cd "$1" || exit } function parse_git_branch() { @@ -111,8 +111,8 @@ function parse_git_branch() { } function my_ip() { - INTERFACE=`ip addr | awk '/state UP/ {print $2}' | sed 's/.$//'` - echo `/sbin/ifconfig $INTERFACE | awk "/inet/ {print $2} " | sed -e s/addr://` + INTERFACE=$(ip addr | awk '/state UP/ {print $2}' | sed 's/.$//') + echo "$(/sbin/ifconfig $INTERFACE | awk "/inet/ {print $2} " | sed -e s/addr://)" } function welcome() { @@ -134,7 +134,7 @@ function welcome() { echo ""; } -[ -r $HOME/.bashrc.aliases ] && . $HOME/.bashrc.aliases +[ -r "$HOME/.bashrc.aliases" ] && . "$HOME/.bashrc.aliases" # export QT_STYLE_OVERRIDE=gtk # export QT_SELECT=qt5 @@ -147,12 +147,12 @@ if [ -n "$SSH_CLIENT" ]; then ssh_placeholder=' {SSH::SESSION}' fi -if [ -f $HOME/.bash-git-prompt/gitprompt.sh ]; then +if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then # To only show the git prompt in or under a repository directory GIT_PROMPT_ONLY_IN_REPO=0 # To use upstream's default theme GIT_PROMPT_THEME=Custom - source $HOME/.bash-git-prompt/gitprompt.sh + source "$HOME/.bash-git-prompt/gitprompt.sh" fi # enable programmable completion features (you don't need to enable @@ -170,14 +170,23 @@ fi [ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors" [ -e "$DIR_COLORS" ] || DIR_COLORS="" -# Initialize Homebrew -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +[ -f "$HOME/.ghcup/env" ] && . "$HOME/.ghcup/env" -# Initialize Starship -eval "$(starship init bash)" +if [ -f "/home/linuxbrew/.linuxbrew/bin/brew" ]; then + # Initialize Homebrew + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +fi -# Initialize Zoxide -eval "$(zoxide init bash)" +if command -v oh-my-posh > /dev/null 2>&1; then + eval "$(oh-my-posh init bash --config "$(brew --prefix oh-my-posh)/themes/peru.omp.json")" +fi -# Activete Mise JDX -eval "$(mise activate bash)" +if command -v zoxide > /dev/null 2>&1; then + # Initialize Zoxide + eval "$(zoxide init bash)" +fi + +if command -v mise > /dev/null 2>&1; then + # Activate Mise JDX + eval "$(mise activate bash)" +fi diff --git a/bash/.bashrc.aliases b/bash/.bashrc.aliases index 80e1168..a28339d 100644 --- a/bash/.bashrc.aliases +++ b/bash/.bashrc.aliases @@ -46,4 +46,4 @@ alias folders='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn' alias vpn-add='nmcli connection import type openvpn file' alias pbcopy='xsel --clipboard --input' alias pbpaste='xsel --clipboard --output' -alias stow='stow --dotfiles' +alias stow='stow --dotfiles -d ~/.dotfiles ' diff --git a/profile/.profile.d/go.sh b/profile/.profile.d/go.sh index 209a116..fc20431 100644 --- a/profile/.profile.d/go.sh +++ b/profile/.profile.d/go.sh @@ -1,4 +1,12 @@ #!/usr/bin/env bash -export GOPATH=$HOME/Library/Go +case $(uname -s) in + "Linux") + export GOPATH="$HOME/.local/share/Go";; + "Darwin") + export GOPATH="$HOME/Library/Go";; + *) + echo "Operating System unknown";; +esac + export GOBIN=$GOPATH/bin diff --git a/profile/.profile.d/graalvm.sh b/profile/.profile.d/graalvm.sh index b993ff2..4471bc4 100644 --- a/profile/.profile.d/graalvm.sh +++ b/profile/.profile.d/graalvm.sh @@ -1 +1,3 @@ -export GRAALVM_HOME="${SDKMAN_CANDIDATES_DIR}/java/21.0.1-graal" +#!/usr/bin/env bash + +export GRAALVM_HOME="${HOME}/.local/share/mise/installs/java/graalvm-community-23.0.1" diff --git a/profile/.profile.d/help.sh b/profile/.profile.d/help.sh index b66f848..7ebd5a2 100644 --- a/profile/.profile.d/help.sh +++ b/profile/.profile.d/help.sh @@ -1 +1,5 @@ -export HELPDIR=/usr/share/zsh/"${ZSH_VERSION}"/help +#!/usr/bin/env bash + +if [[ $SHELL == "zsh" ]]; then + export HELPDIR=/usr/share/zsh/"${ZSH_VERSION}"/help +fi diff --git a/profile/.profile.d/java.sh b/profile/.profile.d/java.sh index d2d3e07..41e1f74 100644 --- a/profile/.profile.d/java.sh +++ b/profile/.profile.d/java.sh @@ -1,2 +1,3 @@ -#export JAVA_HOME=$(/usr/libexec/java_home -v 18) -export JAVA_HOME="$SDKMAN_CANDIDATES_DIR/java/current" \ No newline at end of file +#!/usr/bin/env bash + +export JAVA_HOME="${HOME}/.local/share/mise/installs/java/23.0.1" diff --git a/profile/.profile.d/jmeter.sh b/profile/.profile.d/jmeter.sh index d413316..d4c1838 100644 --- a/profile/.profile.d/jmeter.sh +++ b/profile/.profile.d/jmeter.sh @@ -1,2 +1,4 @@ -export JMETER_HOME=`which jmeter` +#!/usr/bin/env bash +JMETER_HOME="$(which jmeter)" +export JMETER_HOME diff --git a/profile/.profile.d/liquibase.sh b/profile/.profile.d/liquibase.sh deleted file mode 100644 index b1c48c5..0000000 --- a/profile/.profile.d/liquibase.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -export LIQUIBASE_HOME="/opt/homebrew/Cellar/liquibase/4.12.0/libexec" \ No newline at end of file diff --git a/profile/.profile.d/zsh.sh b/profile/.profile.d/zsh.sh index 2e0f808..5623ac3 100644 --- a/profile/.profile.d/zsh.sh +++ b/profile/.profile.d/zsh.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash -export ZSH_HIGHLIGHT_DIR=/opt/homebrew/share/zsh-syntax-highlighting -export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters \ No newline at end of file +if [ "$(uname -o)" == "Darwin" ]; then + export ZSH_HIGHLIGHT_DIR=/opt/homebrew/share/zsh-syntax-highlighting + export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters +fi