From 59402113f71bd63f3c95a369a9dc550bcb5c96d2 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 13 Jul 2020 23:51:08 -0400 Subject: [PATCH] sh: Update to use include() function The exit status of the pipeline: [ -r foo ] && . foo is false if foo doesn't exist. This then becomes the exit status of sourcing my config, which then becomes displayed in a new login prompt. The solution? Use a true if block (which will always return true). Wrap it in a function to keep it clean. --- sh/shrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sh/shrc b/sh/shrc index aeda015..d23a2dc 100755 --- a/sh/shrc +++ b/sh/shrc @@ -24,5 +24,6 @@ last_err() { PS1='$(last_err)[${USER}@${HOSTNAME}]\$ ' # Includes -[ -r "$HOME/.aliases" ] && . "$HOME/.aliases" -[ -r "$HOME/.shrc.local" ] && . "$HOME/.shrc.local" +include() { if [ -r "$1" ]; then . "$1"; fi } +include "$HOME/.aliases" +include "$HOME/.shrc.local" -- libgit2 0.28.4