ksh on Microport 2.2 (.profile source)

John Plocher plocher%sally at Sun.COM
Mon Apr 17 14:10:13 AEST 1989


+---- In article <261 at jwt.UUCP> John Temples writes:
| Has anyone gotten the command editing mode working correctly in the ksh that
| came with Microport V/386 2.2?  Was there a fix in 3.0e?
+----

Include definitions for the environment variables FCEDIT, HISTFILE, & HISTSIZE.
If VISUAL, EDITOR, and FCEDIT end in "macs" (/usr/bin/emacs, /usr/local/umacs)
AND you have 3.0e (or have downloaded the new version from the Microport BBS
[(408) 441-0136 thru 441-0139]) then you can use emacs editing commands instead
of vi-like ones.

	-John Plocher

---- Cut here for what I use as a .profile ----
:
# This is set up so I can use ksh or sh as my login shell and things work.
# $0 is the name of the shell ...
case "$0" in
	-ksh) . ./.profile.ksh ;;
	 ksh) . ./.profile.ksh ;;
	-sh)  . ./.profile.sh  ;;
	 sh)  . ./.profile.sh  ;;
esac

---- Cut here for what I use as .profile.ksh ----
:
echo 0 \\c
# set erase and kill characters to sane values
stty erase  kill  intr 

PATH=.:~/bin:/usr/local:/usr/local/bin:/usr/ucb:/usr/doctools/bin:/usr/bin:\
/usr/etc:/bin:/etc:/usr/hosts:/usr/sccs:/usr/lib:/usr/spool/news/bin:\
/usr/local/bin/mh:/usr/db/bin:/usr/demo:/usr/xnews/local/bin-att386:\
/usr/NeWS/include
# Isn't Wollongong NFS nice?
export PATH

FCEDIT=/usr/bin/vi				export FCEDIT
EDITOR=/usr/bin/vi				export EDITOR
VISUAL=/usr/bin/vi				export VISUAL
MAILDIR=~/Mail					export MAILDIR
SAVEFILE=~/Mail/Outbound		export SAVEFILE
HISTSIZE=128      				export HISTSIZE
HISTFILE=~/.sh_history				export HISTFILE

echo 1 \\c
# change this variable if you want a different default terminal
term=at386

# get the user's terminal type.  If the user is on one of the virtual
# consoles set TERM to ansi by default, if he is logged in on a serial
# line get a term type from him and check to see if it is valid.
cons=`tty`
case $cons in
	/dev/cons* )	# Console
		TERM=at386
		export TERM;;
	/dev/ttyd* )	# Dialup
		while true; do
			echo "terminal type (default = $term): \c"
			read TERM
			termdir=`echo $TERM | cut -c1`
			if [ -z "$TERM" ]; then
				TERM=$term
				export TERM
				break
			elif [ -f "/usr/lib/terminfo/$termdir/$TERM" ]; then
				export TERM
				break
			fi
		done;;
	/dev/tty* )	# Serial terminal  - Could do an /etc/ttys thing here
		TERM=$term
		export TERM;;
esac

echo 2 \\c
# set PS1 to display the host system name
HOSTNAME=`hostname`; export HOSTNAME
PS1='$LOGNAME@$HOSTNAME ($PWD)> '; export PS1

# set default file creation mask, uncomment the line that suits your style
# umask	000		# a foolishly open and trusting environment
umask 022		# a reasonably open, friendly type of environment
# umask 077 	# a totally paranoid, high security installation
echo 3 \\c
# some handy shell functions
x()   { tput clear; exit; }          # get out, quickly
lf() { /bin/ls -CF $*; }		# a sane listing
ll() { /bin/ls -l $*; }			# less typing
echo 4 \\c
# this next one allows you to change your environment when you change 
# directories.  Just put the environment changes (or any other commands)
# in the .profile file.  
cde() {
	cd $* 
	if [ -e .profile ]; then
		. .profile
	fi
}

which() {
   whence -v $*
}

back() {
    if [ "$OLDPWD" = "" ]
    then
        echo "can not back up"
    else
        cd $OLDPWD
    fi
}

pushd()  {
    if cd $1
    then
        DIRSTACK="$OLDPWD $DIRSTACK"
        echo $DIRSTACK
    fi
}

dirs() {
    if [ "$DIRSTACK" = "" ]
    then
        echo "Directory stack is empty"
    else
        echo $DIRSTACK
    fi
}

popd()  {
    if [ "$DIRSTACK" = "" ]
    then
	echo "Directory stack is empty"
    else
	set $DIRSTACK
	cd $1
	shift
	DIRSTACK="$*"
	if [ "$DIRSTACK" != "" ]
	then
	    echo $DIRSTACK
	fi
    fi
}
echo 5

---- Done ----



More information about the Comp.unix.microport mailing list