Sample .profile (sh, ksh)



next up previous contents index
Next: Sample .emacs File Up: SAMPLE DOT FILES Previous: Sample .kshrc (sh

Sample .profile (sh, ksh)

 

 
#
# .profile    -- Commands executed by a login using ksh or sh
#
# Your PATH maybe already set for you.
# To create your own you must know the location of all of the
# executable directories on your system.
# PATH=/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
# Here we add to the PATH by adding our bin directory and
# the current directory to the front of the path
# Footnote about path
PATH=.:$HOME/bin:\$PATH
export PATH

# Set the environmental variable LOGNAME
    LOGNAME=$(logname)
    export LOGNAME
# This is handy variable to have
    HOST=$(hostname)
    export HOST

# Set the MAIL environmental variable so shell inform us of new mail
MAIL=/usr/spool/mail/$LOGNAME 
export MAIL
# If there is a .kshrc then use it. It may be .envfile or .kshenv, 
# the name is determined here so call it what you want.
# The complicated expression says only read .kshrc if
# the shell is interactive, not a shell script.
FILE=$HOME/.kshrc
ENV='$\{FILE[(\_\$-=0)+(\_=1)-\_\$\{-\%\%*i*\}]\}'
export ENV

# Set file  permissions default umask. Makes new files readable by 
# everyone, writable only by the owner.
umask 022

# For systems with tset this line will check if your terminal type
# is xterm. If not it will prompt you to enter a terminal type.
eval `tset -m xterm:xterm -m $TERM:?\$\{TERM:-xterm\} -r -s -Q`

#Don't let \^{}d logout
set -o ignoreeof

# Set a prompt with the hostname in it.
case $LOGNAME in
    root)    PS1="$(HOST)\# " ;;
    *)    PS1="$(HOST)\$ " ;;
esac
export PS1

# This is a nice way to determine what port you are on and start X 
# from console. The tty command returns your port name. Match with 
# name of your console port. We strip off  "/dev/" with sed.
tty=$(tty | sed 's;/dev/;;')
case $tty in
    console )
        # start up X
         xinit 2> /dev/null
        # or
        # startx 2> /dev/null
        exit
        ;;
    hft/*)
        # Under AIX this is the console
        ;;
    tty[1-9]? )
        # Under SCO this would be the name of the console
        ;;
    ttyp[1-9] ) 
        # on a remote login or xterm
        ;;
esac