3 # configuration used for an absolute minimal ksh shell.
4 # Reason: reference no files in /usr/, so that FS can be umounted.
6 # skip this setup for non-interactive shells
7 [[ -o interactive && -t 0 ]] || return
9 export PATH="/bin:/sbin/:/usr/bin/:/usr/sbin:/usr/local/bin:/usr/local/sbin:${HOME}/bin:/opt/bin"
12 if [[ -x $(which vim) ]] ; then
17 if [[ -x $(which less) ]] ; then
23 FPATH=/usr/share/ksh/functions
28 set -o emacs -o trackall -o globstar
30 # aliases for various command shortcuts
31 alias ls='ls --color=auto' # we're on grml, so we do have GNU ls.
34 alias pu='ps -fu $USER'
36 # Use keyboard trap to map keys to other keys
37 # note that escape sequences vary for different terminals so these
38 # may not work for you
39 trap '.sh.edchar=${keymap[${.sh.edchar}]:-${.sh.edchar}}' KEYBD
41 if [[ -x $(which infocmp) ]] && [[ -x $(which sed) ]] ; then
42 # reading some special keys from terminfo database.
43 # should work everywhere. hopefully.
45 infocmp -L | sed '1,2d;s/\t//;s/, /\n/g;s/,$//' | \
46 while read -r line ; do
50 key_left) keymap+=( [$(print "$seq")]=$'\cb' ) ;;
51 key_right) keymap+=( [$(print "$seq")]=$'\cf' ) ;;
52 key_up) keymap+=( [$(print "$seq")]=$'\cp' ) ;;
53 key_down) keymap+=( [$(print "$seq")]=$'\cn' ) ;;
54 key_home) keymap+=( [$(print "$seq")]=$'\ca' ) ;;
55 key_end) keymap+=( [$(print "$seq")]=$'\ce' ) ;;
56 key_backspace) keymap+=( [$(print "$seq")]=$'\ch' ) ;;
57 key_dc) keymap+=( [$(print "$seq")]=$'\cd' ) ;;
61 # fallback, does not work in all terminals.
63 [$'\eOD']=$'\eb' # Ctrl-Left -> move word left
64 [$'\eOC']=$'\ef' # Ctrl-Right -> move word right
65 [$'\e[3~']=$'\cd' # Delete -> delete to right
66 [$'\e[1~']=$'\ca' # Home -> move to beginning of line
67 [$'\e[4~']=$'\ce' # End -> move to end of line
71 # put the current directory and history number in the prompt.
72 # use a wrapper for 'cd' to get '~' instead of /home/foo/.
75 [[ $PWD = $HOME* && $HOME != / ]] && _pwd=\~"${PWD#$HOME}" && return