From: Nicolas Boisselier Date: Mon, 23 Oct 2017 23:38:41 +0000 (+0100) Subject: etc/profile X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8906aa56d04a522bc4f4e408c1ff0d7c5e68d005;p=nb.git etc/profile --- diff --git a/etc/profile b/etc/profile index bf329ed5..11314509 100755 --- a/etc/profile +++ b/etc/profile @@ -5,9 +5,14 @@ # 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 diff --git a/etc/profile.d/aliases b/etc/profile.d/aliases index 27e7be60..c32bb13c 100644 --- a/etc/profile.d/aliases +++ b/etc/profile.d/aliases @@ -31,3 +31,33 @@ bc --version > /dev/null && alias bc="bc -q" # 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 + diff --git a/etc/profile.d/envs b/etc/profile.d/envs index 3d61f419..e3de20d5 100644 --- a/etc/profile.d/envs +++ b/etc/profile.d/envs @@ -95,41 +95,3 @@ if is_prompt; then 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