dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 59402113f71bd63f3c95a369a9dc550bcb5c96d2 (patch)
parent 4becb9bc4833d85a1627c7f74068732af85bb916
Author: Alex Karle <alex@alexkarle.com>
Date:   Mon, 13 Jul 2020 23:51:08 -0400

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.

Diffstat:
Msh/shrc | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 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"