From 47f108f0a3022171b99daed5299158fee1ddeeb7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:45:16 +0100 Subject: [PATCH] source/find --- sh/main.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 61637fb..7da2446 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -24,6 +24,21 @@ sh_source_check() { rm "${file}" } +sh_source_find() { + local root="${1}" + local file="${2}" + set -- \ + "${root}" \ + -name "*.sh" \ + -type "f" + [ -n "${file}" ] && + set -- "${@}" \ + -not \ + -name "${file}" + find "${@}" \ + -printf "%P\n" +} + _sh_main_commands() { local file="${1}" grep "()" "${file}" |