From 00b714f713f2d3dfe795808aebc4d272710c6435 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Mon, 5 Jul 2021 16:45:56 +0100 Subject: [PATCH] updated functions.sh --- .bash.d/functions.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.bash.d/functions.sh b/.bash.d/functions.sh index 2cf1a08a..7eacb278 100644 --- a/.bash.d/functions.sh +++ b/.bash.d/functions.sh @@ -62,14 +62,15 @@ new(){ # sources bash autocompletion from local standardized path autocomplete(){ local name="$1" - if type -P "$name" &>/dev/null; then + if [ -f ~/.bash.autocomplete.d/"$name.sh" ]; then + # shellcheck disable=SC1090 + . ~/.bash.autocomplete.d/"$name.sh" + elif type -P "$name" &>/dev/null; then # doesn't work # shellcheck disable=SC1090 #source <(command "$name" completion bash) - if ! [ -f ~/.bash.autocomplete.d/"$name.sh" ]; then - mkdir -pv ~/.bash.autocomplete.d - command "$name" completion bash > ~/.bash.autocomplete.d/"$name.sh" - fi + mkdir -pv ~/.bash.autocomplete.d + command "$name" completion bash > ~/.bash.autocomplete.d/"$name.sh" # shellcheck disable=SC1090 . ~/.bash.autocomplete.d/"$name.sh" fi