Move all bash files from misc to bash

This commit is contained in:
Eric Torres
2022-09-28 21:26:39 -07:00
parent d0a527f968
commit c3da40c783
6 changed files with 431 additions and 0 deletions

16
bash/search.sh Normal file
View File

@@ -0,0 +1,16 @@
# Utility functions and helpers for searching
DEFAULT_FD_OPTS=('--hidden' '--type' 'f' '--type' 'l' '--threads' "$(nproc)")
# Search and return a string with filenames delimited by \n
# Parameters:
# $1: directory
# $2-n: extra arguments
find_files() {
if [[ -d "$1" ]]; then
local directory="$1"
shift
fd "${DEFAULT_FD_OPTS[@]}" "$@" -- . "$directory"
else
fd "${DEFAULT_FD_OPTS[@]}" "$@"
fi
}