dotfiles

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

commit d50a8d3f63f1e1bfef8fdc8b46d36e4dfad62586 (patch)
parent ff776b83567ccdb10396d916fc407499a085e047
Author: Alex Karle <alex@karle.co>
Date:   Tue,  4 Jun 2019 22:00:32 -0400

[bash] make source_if_exists function always return 0

I have a "source_if_exists" function which was really just to enhance
readability, make changes easier, etc.

However, it was returning 1 if the file did not exist, and if that call
was the last in the bashrc, it would display the [1] in my bash prompt.

This commit changes the function to be an if statement instead of a &&,
thus returning 0 if the file does not exist.

Diffstat:
Mbash/bashrc | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bash/bashrc b/bash/bashrc @@ -36,7 +36,9 @@ fi # Source helper files, both mine and other's function source_if_exists { - [ -r "$1" ] && source "$1" + if [ -r "$1" ]; then + source "$1" + fi } source_if_exists "$HOME/.bash/git-completion.bash" # Git Completion