bash 'header' files
# So you want to load a set of library functions but not
# constantly reload if they are already loaded?
#
# For example:
if [[ ! -n $__UTILS_LOADED__ ]]
then
function print { local line="$@"; printf "%s\n" "$line"; }
function map { local l; while read -r l; do $1 $l; done; }
print '*** UTILS LOADED ***'
__UTILS_LOADED__=TRUE
fi
# Now you can put...
source /some/path/to/lib/utils.sh
# ...where ever you want.
# constantly reload if they are already loaded?
#
# For example:
if [[ ! -n $__UTILS_LOADED__ ]]
then
function print { local line="$@"; printf "%s\n" "$line"; }
function map { local l; while read -r l; do $1 $l; done; }
print '*** UTILS LOADED ***'
__UTILS_LOADED__=TRUE
fi
# Now you can put...
source /some/path/to/lib/utils.sh
# ...where ever you want.
Comments
Post a Comment