home *** CD-ROM | disk | FTP | other *** search
- # Contributed by Noah Friedman.
-
- # To avoid using a function in bash, you can use the `builtin' or
- # `command' builtins, but neither guarantees that you use an external
- # program instead of a bash builtin if there's a builtin by that name. So
- # this function can be used like `command' except that it guarantees the
- # program is external by first disabling any builtin by that name. After
- # the command is done executing, the state of the builtin is restored.
- function external ()
- {
- local state=$(builtin type -type "$1" 2> /dev/null)
- local exit_status
-
- [ "${state}" = "builtin" ] && enable -n "$1"
- command "$@"
- exit_status=$?
- [ "${state}" = "builtin" ] && enable "$1"
- return ${exit_status}
- }
-