SETTING UP KSH93 vs PDKSH

e.g. on Slackware Linux

SLACKWARE // KSH93

It is alredy the default KSH flavor.

SLACKWARE // PDKSH

/usr/sbin/slackpkg search ksh
/sbin/removepkg ksh93
/usr/sbin/slackpkg install pdksh
mv /bin/ksh /bin/ksh.trash
ln -s pdksh /bin/ksh
cat /etc/shells

chsh -s /bin/ksh root
useradd -D -s /bin/ksh

#mkdir ~/.trash/
#mv /etc/profile.d/modules.* ~/.trash/

SLACKWARE // BOTH

At the end of e.g. /etc/profile,

export ENV=/etc/shrc

Check at login,

^V

SETUP // BOTH

this setup is even compatible with BASH,

vi /etc/shrc #new file

case "$-" in *i*)
        ( set -o emacs 2>/dev/null ) && set -o emacs

    [[ -z $HOST ]] && HOST=`uname -n`
    (( `id -u` == 0 )) && PS1='$HOST# ' || PS1='$HOST> '

    alias ll='ls -alhF'
    alias l='ls -altrhF'
    alias cp='cp -i'
    alias mv='mv -i'
    alias rm='rm -i'

    alias netstata='netstat -antupe --inet --inet6'
    alias runq='postfix flush'

    alias lynxg='lynx -accept_all_cookies google.com/ncr'
    alias lynx='lynx -accept_all_cookies'

    alias push='git nc && git push'
    alias stat='git diff --stat --cached origin/master'

    alias ovs='ovs-vsctl'

    export TERM=xterm
    #export TERM=linux

    j=$((`grep ^processor /proc/cpuinfo | tail -1 | awk '{print $3}'` + 1))
    export MAKEFLAGS=-j$j
    unset j
    ;;
esac

SETUP // KSH93 ADDONS

keybd_trap () {
    case ${.sh.edchar} in
        $'\f')    .sh.edchar=$'\e\f';;  # clear-screen (THIS QUESTION)
        $'\e[1~') .sh.edchar=$'\001';;  # Home = beginning-of-line
        $'\e[4~') .sh.edchar=$'\005';;  # End = end-of-line
        $'\e[5~') .sh.edchar=$'\e>';;   # PgUp = history-previous
        $'\e[6~') .sh.edchar=$'\e<';;   # PgDn = history-next
        $'\e[3~') .sh.edchar=$'\004';;  # Delete = delete-char
    esac
}

case "$-" in *i*)
    ...
        trap keybd_trap KEYBD
            set -o tabcomplete

SETUP // PDKSH ADDONS

    case "$-" in *i*)
    ...
            bind -m ^L='clear^M'
            bind ^I=complete-list

READY TO GO

apply,

. /etc/profile

RESOURCES

Last update 2018-12-10 | Home | Very old doc | Old doc | New doc | HTML/CSS