hb

A handbook for UNIX

commit 48e3c991c7953608913a4b8a268a5d36bd8f0bb3
parent 3f34b151b4bd795abba6f162800809f1f254adb4
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Fri, 9 Sep 2022 04:01:32 +0530

Use `find` for filtering files

Use `which` instead of `where` as it is more portable
1 file changed, 2 insertions(+), 2 deletions(-)
M
nb
|
4
++--
diff --git a/nb b/nb
@@ -9,7 +9,7 @@ nb_fatal_error() {
 
 nb_browse() {
 	cd "${NB_PATH}"
-	file="$(${FUZZER})"
+	file="$(find . -type f | ${FUZZER})"
 	[ "${file}" != "" ] && ${EDITOR} "${file}"
 }
 

@@ -50,7 +50,7 @@ nb_usage() {
 
 test -z "${EDITOR}" && { export EDITOR=vi; }
 # TODO detect windows, type on windows invokes a different command, this should be fixed before merging to main
-where "${EDITOR}" >/dev/null 2>/dev/null || { export EDITOR=cat; }
+which "${EDITOR}" >/dev/null 2>/dev/null || { export EDITOR=cat; }
 
 test -d "${NB_PATH}" || { nb_fatal_error "NB_PATH is not a directory"; exit 1; }
 cd "${NB_PATH}" || nb_fatal_error "NB_PATH is not a directory"