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.

This commit is contained in:
Roy Marples
2008-04-18 23:00:43 +00:00
parent f0aacec02e
commit e96347523f
3 changed files with 29 additions and 20 deletions

View File

@@ -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