From ce77cd0f94ed5bfec51d49c845bee72f9aa43652 Mon Sep 17 00:00:00 2001 From: Donaldttt Date: Sat, 18 Jun 2022 22:57:55 -0400 Subject: [PATCH] improve logic --- bash_tools/fzf_file_seletor.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bash_tools/fzf_file_seletor.sh b/bash_tools/fzf_file_seletor.sh index cd6068d..bc5cdea 100755 --- a/bash_tools/fzf_file_seletor.sh +++ b/bash_tools/fzf_file_seletor.sh @@ -110,6 +110,11 @@ function fzf_selector() { files=() for item in "${all_items[@]}"; do + # if the keyword equals to a file or folder, returns + # it. + if [ "$item" = "$1" ] || [ "$item" = "$1/" ]; then + return 0 + fi grep $1 <<< $item > /dev/null 2>&1 && \ files+=("$item") done