From d50a8d3f63f1e1bfef8fdc8b46d36e4dfad62586 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Tue, 4 Jun 2019 22:00:32 -0400 Subject: [PATCH] [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. --- bash/bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/bashrc b/bash/bashrc index d8b7763..053227d 100644 --- 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 -- libgit2 0.28.4