From: Matthias Kruk Date: Thu, 6 Oct 2022 06:21:44 +0000 (+0900) Subject: toolbox.sh: Suppress errors in command_not_found_handle() X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=35cfcb5f018bda06e0aae2d87a637fda3693bb3c;p=toolbox 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. --- 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