From e833823e15833122881a2cab333124c23fcc6ba5 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Mon, 2 Oct 2023 14:02:35 +0200 Subject: [PATCH] =?UTF-8?q?[bash]=20Don=E2=80=99t=20print=20function=20def?= =?UTF-8?q?inition=20when=20checking=20for=20existence=20(#3448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When just checking whether a function is already defined or not, it’s not necessary to print out it’s definition (should it be defined). bash’s `declare` provides the `-F`-option (which implies `-f`), which should give a minor performance improvement Signed-off-by: Christoph Anton Mitterer --- shell/completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/completion.bash b/shell/completion.bash index 360a646e..a51713c6 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -12,7 +12,7 @@ if [[ $- =~ i ]]; then # To use custom commands instead of find, override _fzf_compgen_{path,dir} -if ! declare -f _fzf_compgen_path > /dev/null; then +if ! declare -F _fzf_compgen_path > /dev/null; then _fzf_compgen_path() { echo "$1" command find -L "$1" \ @@ -21,7 +21,7 @@ if ! declare -f _fzf_compgen_path > /dev/null; then } fi -if ! declare -f _fzf_compgen_dir > /dev/null; then +if ! declare -F _fzf_compgen_dir > /dev/null; then _fzf_compgen_dir() { command find -L "$1" \ -name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \