From e96347523f7bfa7da55c34c34af6dcdedd939ba9 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 18 Apr 2008 23:00:43 +0000 Subject: We should check type output to ensure that we're really calling a shell function and not some badly named binary like stop from boinc, Gentoo #218063. --- sh/functions.sh.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sh/functions.sh.in') diff --git a/sh/functions.sh.in b/sh/functions.sh.in index 57917ed..8b7356a 100644 --- a/sh/functions.sh.in +++ b/sh/functions.sh.in @@ -20,6 +20,15 @@ eoutdent() return 0 } +is_function() +{ + if [ -n "${BASH_VERSION}" ]; then + [ "$(type -t "$1")" = "function" ] + else + [ "$(type "$1" 2>/dev/null)" = "$1 is a shell function" ] + fi +} + yesno() { [ -z "$1" ] && return 1 -- cgit v1.2.3