3
0
Fork 0
forked from mirrors/nixpkgs

* Add file support in the runHook function.

svn path=/nixpkgs/branches/stdenv-updates/; revision=18467
This commit is contained in:
Nicolas Pierron 2009-11-19 17:19:32 +00:00
parent 8c638e5e68
commit 6ba27ab552

View file

@ -4,11 +4,12 @@
# environment variables) and from shell scripts (as functions).
runHook() {
local hookName="$1"
if test "$(type -t $hookName)" = function; then
$hookName
else
eval "${!hookName}"
fi
case "$(type -t $hookName)" in
(function|alias|builtin) $hookName;;
(file) source $hookName;;
(keyword) :;;
(*) eval "${!hookName}";;
esac
}