diff options
author | Roy Marples <roy@marples.name> | 2008-04-18 23:00:43 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-04-18 23:00:43 +0000 |
commit | e96347523f7bfa7da55c34c34af6dcdedd939ba9 (patch) | |
tree | 181b118e8ad7640d6c6ffe33263d401657b8b3d1 /sh/functions.sh.in | |
parent | f0aacec02eb04f1843cc5c729fd5510c2342660c (diff) |
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.
Diffstat (limited to 'sh/functions.sh.in')
-rw-r--r-- | sh/functions.sh.in | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sh/functions.sh.in b/sh/functions.sh.in index 57917ed3..8b7356aa 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 |