1 # Contributed by Noah Friedman.
3 # To avoid using a function in bash, you can use the `builtin' or
4 # `command' builtins, but neither guarantees that you use an external
5 # program instead of a bash builtin if there's a builtin by that name. So
6 # this function can be used like `command' except that it guarantees the
7 # program is external by first disabling any builtin by that name. After
8 # the command is done executing, the state of the builtin is restored.
14 if builtin_p "$1"; then
22 if [ "$state" = "builtin" ]; then
29 # What is does is tell you if a particular keyword is currently enabled as
30 # a shell builtin. It does NOT tell you if invoking that keyword will
31 # necessarily run the builtin. For that, do something like
33 # test "$(builtin type -type [keyword])" = "builtin"
35 # Note also, that disabling a builtin with "enable -n" will make builtin_p
36 # return false, since the builtin is no longer available.
41 set $(builtin type -all -type "$1")
44 if [ "${word}" = "builtin" ]; then