return 0
}
-nb_file_as_tag() { [ "$(head -1 "$1")" = "# <NB_TAG>" ]; }
+_nb_file_has_tag() { [ "$(head -1 "$1")" = "# <NB_TAG>" ]; }
#
# Avoid infinit loop. Eg: profile -> .bashrc -> profile
for i in /*/*/etc/profile.d/nb.sh /*/*/*/etc/profile.d/nb.sh; do
cd "$(dirname "$i")"/.. 1>/dev/null 2>&1 || continue
- nb_file_as_tag ../profile || continue
+ _nb_file_has_tag ../profile || continue
NB_ETC_DIR=$PWD #|| unset NB_ETC_DIR
break
_nb_unset() {
unset i tmp NB_ETC_DIR NB_DEBUG NB_LOOP
+ unset -f _nb_file_has_tag 2> /dev/null
return 0
}
#echo "+$NB_ETC_DIR"
#echo $NB_ETC_DIR; #return
- # Check to avoid system crash !
+ # Load source file "functions" and avoid system crash !
nb_debug ". $NB_ETC_DIR/profile.d/functions"
if [ ! -e "$NB_ETC_DIR/profile.d/functions" ] || ! . "$NB_ETC_DIR/profile.d/functions"; then
echo "ERR: $NB_ETC_DIR: Wrong directory (no profile.d/functions)" 1>&2
; do
case "$i" in
# no multiple include from other branch
- */etc/profile) nb_file_as_tag "$i" && nb_debug "IGNORE $i" && continue ;;
+ */etc/profile) _nb_file_has_tag "$i" && nb_debug "IGNORE $i" && continue ;;
esac
nb_debug ". $i"
[ -r "$i" -a -f "$i" ] && . "$i"