Fixes to binary finding
This commit is contained in:
parent
4d7719af2c
commit
3ec6f4991e
@ -35,7 +35,7 @@ while true; do
|
||||
done
|
||||
|
||||
# check for existence of fd and fzf binaries
|
||||
if [[ ! -x '/usr/bin/fzf' ]]; then
|
||||
if ! $(which fzf > /dev/null); then
|
||||
printf '%s\n' 'fzf is not installed on the system'
|
||||
exit 1
|
||||
fi
|
||||
@ -43,13 +43,13 @@ fi
|
||||
declare -a find_opts
|
||||
template_dir="${HOME}/Templates"
|
||||
|
||||
if [[ -x '/usr/bin/fd' ]]; then
|
||||
find_bin='/usr/bin/fd'
|
||||
if [[ -x $(which fd) ]]; then
|
||||
find_bin=$(which fd)
|
||||
find_opts+=('--print0')
|
||||
find_opts+=('--type' 'f')
|
||||
find_opts+=('.' "${template_dir}")
|
||||
find_opts+=('--' '.' "${template_dir}")
|
||||
else
|
||||
find_bin='/usr/bin/find'
|
||||
find_bin=$(which find)
|
||||
find_opts+=("${template_dir}")
|
||||
find_opts+=('-mindepth' '0')
|
||||
find_opts+=('-type' 'f')
|
||||
|
@ -28,7 +28,7 @@ declare -a fd_opts
|
||||
declare -r blue='\033[0;34m'
|
||||
declare -r nocolor='\033[0;0m'
|
||||
|
||||
[[ ! -x '/usr/bin/fd' ]] && echo 'fd is not present, cancelling' >&2 && exit 1
|
||||
[[ -z "$(which fd)" ]] && echo 'fd is not present, cancelling' >&2 && exit 1
|
||||
|
||||
while true; do
|
||||
case "${1}" in
|
||||
@ -85,7 +85,7 @@ for filename in "${files[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s' "Would you like to delete these files? "
|
||||
printf '%s' "Would you like to delete these files? [y/n] "
|
||||
read -r -n 1 ans
|
||||
|
||||
if [[ "${ans:-n}" =~ (Y|y) ]]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user