diff options
-rw-r--r-- | .config/bash/rc.d/10_aliases.sh | 14 | ||||
-rw-r--r-- | .config/login.d/00_path.sh | 11 |
2 files changed, 13 insertions, 12 deletions
diff --git a/.config/bash/rc.d/10_aliases.sh b/.config/bash/rc.d/10_aliases.sh index c3766da..9d008e2 100644 --- a/.config/bash/rc.d/10_aliases.sh +++ b/.config/bash/rc.d/10_aliases.sh @@ -3,9 +3,15 @@ ###################################################################### # Set up colors and settings for all the things # ###################################################################### -if [ -x "`which dircolors`" ]; then - eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | - dircolors -b -)" +if type dircolors &>/dev/null; then + eval "$( + { + dircolors -p + if [[ -f "${XDG_CONFIG_HOME}/dir_colors" ]]; then + cat "${XDG_CONFIG_HOME}/dir_colors" + fi + } | dircolors -b - + )" alias ls='ls -1v --color=auto' alias dir='dir -v --color=auto' alias vdir='vdir -v --color=auto' @@ -63,7 +69,7 @@ if [ -x "`which dircolors`" ]; then } diff() { - if [[ -t 1 ]]; then + if [[ -t 1 ]] && type colordiff &>/dev/null; then ( set -o pipefail command diff "$@" | colordiff diff --git a/.config/login.d/00_path.sh b/.config/login.d/00_path.sh index ae2e8db..aa62f75 100644 --- a/.config/login.d/00_path.sh +++ b/.config/login.d/00_path.sh @@ -1,12 +1,7 @@ #!/hint/sh -eval "$( if type config-path &>/dev/null; then - config_path=config-path -else + eval "$(config-path | sed 's/^/export /')" +elif [[ -x "$HOME/.local/bin/config-path" ]]; then # Bootstrap finding config-path - config_path="$HOME/.local/bin/config-path" + eval "$("$HOME/.local/bin/config-path" | sed 's/^/export /')" fi -IFS=$'\n' -lines=($("$config_path")) -printf -- 'export %s\n' "${lines[@]}" -)" |