# ---------------------------------------------------------------------+ # file: .mkshrc + # visit: Ypnose - http://ywstd.fr +. # this is not *the* original. - # ---------------------------------------------------------------------+ MKSH_MAIN_LOADED=${MKSH_MAIN_LOADED:-false} # -- INTERACTIVE? ------- [[ $- != *i* ]] && return case $KSH_VERSION in *MIRBSD\ KSH*) ;; *) return 0 ;; esac # -- EDITING MODE ------- set -o emacs #set -o vi #no timeout! -give'em your access already. #tty | grep -q 'tty[0-9]' &&readonly TMOUT=120 # ruin the standard PATH export PATH=/bin:/usr/bin function +chk { function +Q { typeset e e=$(print -nr "$1" |awk '{ gsub(/\/*$/,"",$0); print }') e=$(print -nr "$e" |awk '{ gsub(/\//,"\\/",$0); print }') print "$e" } print "$1" |awk -F: 'BEGIN { r=0 } { for (i=1;i<=NF;i++) { if ($i ~ /^'"$(+Q "$2")"\ '$/) { r=1; exit }}} END { exit r }' } function +bPATH { [[ -d $1 ]] \ && +chk "$PATH" "$1" \ && export PATH="$1${PATH:+:$PATH}" } function +mPATH { [[ -d $1 ]] \ && +chk "$MANPATH" "$1" \ && export MANPATH="$1:${MANPATH}${MANPATH:-/usr/share/man:/usr/local/share/man}" } +bPATH /opt/rypp/bin +mPATH /opt/rypp/share/man if [[ $USER_ID == 0 ]]; then +bPATH /usr/sbin +bPATH /sbin fi # -- PS1 -------- PS1=$'\001\033[1m${ typeset e=$? if (( e ));then print -nr -- $e fi return $e }\033[0m \033[1;${ typeset e=$? if [[ $USER_ID == 0 ]];then print -nr -- 31 else print -nr -- 33 fi return $e }m=-.-=\033[0m\001 ' # -- BINDINGS -------- bind '^L'=clear-screen stty -ixon # -- SOURCES ----- : ${ typeset i [[ -d $HOME/.dirash ]] \ && for i in $HOME/.dirash/*.rc;do [[ -r $i ]] && . "$i" ;done } # -- ALIASES --------- [[ -r ${HOME}/.aliases ]] && . "${HOME}/.aliases" export MKSH_MAIN_LOADED=true