[unix-pc.general] Another cute FKey thing in Ksh...

darren@bacchus.UUCP (Darren Friedlein) (09/16/88)

Since people are posting cute ways to use function keys from ksh, I
just HAD to post this.  It's really a joke, it's so slow, but here's
an excert from my .profile that lets me redefine function keys as
usefull things.  It's pretty short.  Comments are welcome!-)
-----
set -oa emacs
alias _A='mA
alias _N='mN
alias _O='mO
alias _P='mP

function mO {
	stty raw
	inchar=`dd bs=1 count=1 2>/dev/null`
	stty cooked
	cmddd=''
	case "$inchar" in
		"c")	cmddd='ls';;
		"d")	cmddd='ls -la';;
		"e")	cmddd='ls -la | more';;
		"f")	cmddd='mailx';;
	esac
	echo "[1A$PS1[0K$cmddd"
	{ $cmddd; }
}
-----
-darren
         ____
        /    \
       |                                 Rt 4, Box 416, Durham, NC 27703
  _____|_____     Darren G. Friedlein      data (bacchus) : 919/596-7746
 /     |     \                                      voice : 919/596-9492
(      |      )
 \____/    __/   {mcnc|icus|ditka|ethos|gladys|bakerst}!bacchus!darren