03 November

ksh startup files

Clean them up!

Tonight I spent some time to clean up my ksh setup. I had a huge .profile, which was just a copy of /etc/ksh.kshrc. No good. Now I have the stock .profile (that comes for new users in OpenBSD) with this line added:

export ENV=$HOME/.kshrc

and then I have put in a shiny new ~/.kshrc with something like this in it:

if [ -o interactive ]; then
    . /etc/ksh.kshrc

spwd () {
  ( IFS=/
    set $PWD
    if test $# -le 3 ; then
        echo "$PWD"
        eval echo \"..\${$(($#-1))}/\${$#}\"
    fi ) ; }

HOST=`hostname| cut -d. -f1`
# PS1='${HOST} ${PWD##$HOME?(/)}$ '
PS1='${HOST} $(spwd)$ '

export EXINIT='set ai sw=4'

if [ -o interactive ]; then
    echo coming up:
    /usr/bin/calendar -A 14

This keeps my prompt pretty short (it displays only the last 2 directories) and gives me otherwise and nice, clear prompt. I played around with using vi key bindings for shell line editing again, but again moved back.

It also displays my calendar contents for the next 14 days. Neato. Read man calendar for how to feed that calendar!

On a related side note, in OS X you can now remap the Caps Lock key to act as a Control key without any hax0ring around: Can be changed from the System Preferences -> Keyboard & Mouse -> Keyboard -> Modifier Keys. Nice.

Posted by betabug at 21:17 | Comments (1) | Trackbacks (0)
<< resizing partitions in os x | Main | fedora upgrading >>
Re: ksh startup files

Good tips, I'll probe it later :D

Posted by: r0sk at November 05,2007 12:14
Please send trackback to: http://betabug.ch/blogs/bsdcow/28/tbping
There are no trackbacks.
Leave a comment
Please note: Comments are moderated. Your comment will not show up until I can have a look at it and decide it's not SPAM. Sorry for the inconvenience.