From 5e5b1f4b2a1fba9fa6cf755260d10a14050b7234 Mon Sep 17 00:00:00 2001 From: The Magician Date: Sun, 10 Dec 2023 15:55:22 +0000 Subject: [PATCH] Make shellcheck fixes --- bash/.bashrc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bash/.bashrc b/bash/.bashrc index 215d521..fb147ee 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -47,10 +47,12 @@ export LESS_TERMCAP_ue="" export LESS_TERMCAP_us="" # Enable dircolors -if test -x "$(command -v dircolors)"; then - test -r ~/.config/shell/dircolors && - eval "$(dircolors -b ~/.config/shell/dircolors)" || +if [[ -x "$(command -v dircolors)" ]]; then + if [[ -r ~/.config/shell/dircolors ]]; then + eval "$(dircolors -b ~/.config/shell/dircolors)" + else eval "$(dircolors -b)" + fi fi # Safety features @@ -67,11 +69,11 @@ source ~/.config/shell/aliasrc # Functions md() { - mkdir -p "$1" && cd "$1" + mkdir -p "$1" && cd "$1" || return } # Automatically run tmux if we aren't already in a session and there's no matching session already running -if [[ -z "$TMUX" && -z "$(tmux list-sessions | grep $HOSTNAME)" ]]; then +if [[ -z "$TMUX" ]] && ! tmux list-sessions | grep --quiet "$HOSTNAME"; then tmux new -s "$HOSTNAME" fi