From 35cfcb5f018bda06e0aae2d87a637fda3693bb3c Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Thu, 6 Oct 2022 15:21:44 +0900 Subject: [PATCH] toolbox.sh: Suppress errors in command_not_found_handle() When the user enters an unknown command, or a script contains an unknown command, the command_not_found_handle() function provides suggestions if the unknown command appears to be in a module. However, because the function does not suppress errors when looking for modules in the module search paths, it emits errors if any of the search paths do not exist. This commit makes the command_not_found_handle() function suppress errors if any of the module search paths do not exist. --- toolbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolbox.sh b/toolbox.sh index b267299..b234b8d 100644 --- a/toolbox.sh +++ b/toolbox.sh @@ -133,7 +133,7 @@ command_not_found_handle() { if [[ "$command" == "$prefix"* ]]; then candidates["$module_name"]="$module" fi - done < <(find -L "$searchpath" -type f -iname "*.sh") + done < <(find -L "$searchpath" -type f -iname "*.sh" 2>/dev/null) done if (( ${#candidates[@]} > 0 )); then -- 2.47.3