From 3c6b2d3b3526dda2c3f05baf5064f3a72f5a9c71 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sun, 26 May 2019 18:22:31 +0200 Subject: [PATCH] execute_function: execute function if exist --- bashbot.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bashbot.sh b/bashbot.sh index 822af00..be61d86 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.90-dev2-3-g483da5a +#### $$VERSION$$ v0.90-dev2-4-gb60f33a # # Exit Codes: # - 0 sucess (hopefully) @@ -198,6 +198,10 @@ _exists() [ "$(LC_ALL=C type -t "$1")" = "file" ] } +# execute function if exists +_execute_function() { + [ "$(LC_ALL=C type -t "${1}")" = "function" ] && "$@" +} # returns true if function exist _is_function() {