#echo $NB_CURRENT_DIR; return
[ -e "$NB_CURRENT_DIR/profile.d/functions" ] && . "$NB_CURRENT_DIR/profile.d/functions"
+ echo $(realpath $NB_CURRENT_DIR/..)
export NB_ROOT=$(realpath $NB_CURRENT_DIR/.. 2>/dev/null)
[ -n "$NB_DEBUG" ] && $NB_DEBUG "NB_ROOT=$NB_ROOT"
*/sh) SHELL_NAME=sh ;;
*/bash) SHELL_NAME=bash ;;
*)
- case "$(realpath /bin/grep)" in
- *busybox*) SHELL_NAME="busybox" ;;
- *)
- [ -n "$ZSH_NAME" ] && SHELL_NAME=zsh
- ;;
- esac
+ if ls --help 2>&1 | grep -qm1 ^BusyBox; then
+ SHELL_NAME="busybox"
+ elif [ -n "$ZSH_NAME" ]; then
+ SHELL_NAME=zsh
+ fi
;;
esac
export SHELL_NAME
[ -z "$env_value" ] || echo "$env_value"
}
+if !which realpath 2>/dev/null; then
realpath() {
- if [ -x /usr/bin/realpath ]; then
- /usr/bin/realpath "$1"
- elif which perl &> /dev/null; then
+ if which perl &> /dev/null; then
perl -MFile::Spec -MCwd -e 'print File::Spec->rel2abs( Cwd::abs_path($ARGV[0]) )."\n" if -e $ARGV[0]' "$1"
else
case "$OSTYPE" in
- darwin*) readlinks "$1" ;;
- *) readlinks -f "$1" ;;
+ darwin*) readlink "$1" ;;
+ *) readlink -f "$1" ;;
esac
fi
}
+fi
ascii() {