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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user