Move all bash files from misc to bash
This commit is contained in:
16
bash/search.sh
Normal file
16
bash/search.sh
Normal 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
|
||||
}
|
Reference in New Issue
Block a user