2 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
4 # Last modified: 1993-09-29
11 # Usage: source file ...
13 # Source forces file arguments to be considered in the current directory
14 # only, unless there is an absolute path starting with `/'. I think it's
15 # bad that the builtin "source" searches PATH, because PATH normally
16 # contains directories with binary files that aren't useful for bash to
17 # read and most people don't put "." first in their path.
19 # This "source" is capable of reading more than one file at a time. Return
20 # value is number of failed source attempts.
23 # This function is not hygienic, but there's not much we can do about
24 # variable name conflicts here.
29 local -i _source_failure_count
=0
33 # Check first part of each filename. If it's not `/', `./', or
34 # `../' then prepend "./" to the path to force the builtin `source'
35 # not to go searching through PATH to find the file.
36 case "${_source_file}" in
38 * ) _source_file
="./${_source_file}" ;;
41 builtin source "${_source_file}" ||
42 _source_failure_count
="_source_failure_count + 1"
46 return ${_source_failure_count}
53 # So that `.' will call function definition of `source' instead of builtin
63 # source.bash ends here