# To test:
# docker run --rm -it -v $NB_ROOT:$NB_ROOT alpine sh -c " . $NB_ROOT/etc/profile --debug && nb_repos && echo OK"
#
+# Load order:
+# 1. etc/profile.d/function
+# 2. etc/profile.d/envs
+# 3. etc/profile.d/alias
+# 4. etc/profile.d/*.sh
#
#--------------------------------------------------------------------------------
-[ "$1" = "--debug-nb" ] && export NB_DEBUG="echo DEBUG: " && shift
+[ "$1" = "--nb-debug" ] && export NB_DEBUG="echo DEBUG: " && shift
#
# Avoid infinit loop. Eg: profile -> .bashrc -> profile
# vim
#
vim --version > /dev/null && alias vi=vim
+
+#--------------------------------------------------------------------------------
+# ls
+#
+ls_opt=' -aF'
+ll_opt=' -lh'
+
+#if [ "$SHELL_NAME" != "busybox" ]; then
+if ! ls --help 2>&1 | grep -qm1 ^BusyBox; then
+
+ if [ -n "$DARWIN" ]; then
+ [ "$color_prompt" = yes ] && ls_opt="$ls_opt -G"
+ else
+ [ "$color_prompt" = yes ] && ls_opt="$ls_opt --color=auto"
+ ll_opt="$ll_opt --time-style=long-iso"
+ fi
+
+fi
+
+[ -n "$ls_opt" ] && alias ls="ls${ls_opt}"
+[ -n "$ll_opt" ] && alias ll="ls${ll_opt}"
+unset ls_opt ll_opt
+
+#--------------------------------------------------------------------------------
+# grep
+#
+if ! grep --help 2>&1 | grep -qm1 ^BusyBox; then
+ alias grep='grep --color=auto'
+fi
+
linux) color_prompt=yes;;
esac
fi
-
-#
-# Alias ls
-#
-ls_opt=' -aF'
-ll_opt=' -lh'
-
-#if [ "$SHELL_NAME" != "busybox" ]; then
-if ! ls --help 2>&1 | grep -qm1 ^BusyBox; then
-
- if [ -n "$DARWIN" ]; then
- [ "$color_prompt" = yes ] && ls_opt="$ls_opt -G"
- else
- [ "$color_prompt" = yes ] && ls_opt="$ls_opt --color=auto"
- ll_opt="$ll_opt --time-style=long-iso"
- fi
-
-fi
-
-[ -n "$ls_opt" ] && alias ls="ls${ls_opt}"
-[ -n "$ll_opt" ] && alias ll="ls${ll_opt}"
-unset ls_opt ll_opt
-
-#
-# Alias grep
-#
-if ! grep --help 2>&1 | grep -qm1 ^BusyBox; then
- alias grep='grep --color=auto'
-fi
-
-#
-# bye
-#
-#[ -n "$NB_DEBUG" ] && $NB_DEBUG "Color: $color_prompt, TERM=$TERM"
-[ -n "$NB_DEBUG" ] && [ -n "$color_prompt" ] && $NB_DEBUG "Color: $color_prompt"
-[ -n "$NB_DEBUG" ] && [ -n "$TERM" ] && $NB_DEBUG "TERM=$TERM"
-
-# NB 24.10.17 unset color_prompt