Looking at Your ksh Configuration Files

As Code Listing 8.14 (on the next page) shows, you look at your ksh configuration files using more or the editor of your choice. Keep in mind that configuration files are run in a specific order:

  • System-wide configuration files (such as /etc/profile) run first upon log in.

  • Configuration files specific to your Unix account (such as ~/.profile) run next if they’re available.

To look at your ksh configuration files:

1.
more /etc/profile ~/.profile

Type more followed by the names of traditional Korn shell configuration files. You’ll see something similar to Code Listing 8.14. As before, look for any other filenames or ENV statements in the listings that would indicate other files that play a role in getting your ksh environment configured.

2.
For your own information, list the system configuration files that your system uses and the order in which they’re called. For our system, we have

  • /etc/profile (automatically called by the system)

  • ~/.profile (automatically called by the system)

✓ Tip

  • The .profile file is executed when you start a new login shell (by logging in or with su - yourid). The .kshrc file is read each time you start any ksh subshell.


Fill in Your ksh System Configuration Files

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________


Code Listing 8.14. Look for file and path names or ENV statements in the configuration file listings (for the files you have) to identify all of the files that help set up your environment.
$ more /etc/profile ~/.profile
::::::::::::::
/etc/profile
::::::::::::::
#ident  "@(#)profile1.17     95/03/28 SMI"   /* SVr4.0 1.3   */
# The profile that all logins get before using their own .profile.
trap ""  2 3
export LOGNAME PATH
if [ "$TERM" = "" ]
then
    if /bin/i386
    then
    TERM=AT386
    else
    TERM=sun
    fi
    export TERM
fi
#      Login and -su shells get /etc/profile services.
#      -rsh is given its environment in its .profile.
case "$0" in
-sh | -ksh | -jsh)
    if [ ! -f .hushlogin ]
    then
    /usr/sbin/quota
    #    Allow the user to break the Message-Of-The-Day only.
    trap "trap '' 2"  2
    /bin/cat -s /etc/motd
    trap "" 2
    /bin/mail -E
    case $? in
    0)
    echo "You have new mail."
    ;;
    2)
    echo "You have mail."
    ;;
    esac
    fi
esac
umask 022
trap  2 3
::::::::::::::
/home/users/e/ejray/.profile
::::::::::::::
#
PATH=$PATH:$HOME/bin:.  # set command search path
export PATH
if [ -z "$LOGNAME" ]; then
    LOGNAME='logname' # name of user who logged in
    export LOGNAME
fi
MAIL=/usr/spool/mail/$LOGNAME   # mailbox location
export MAIL
if [ -z "$PWD" ]; then
    PWD=$HOME   # assumes initial cwd is HOME
    export PWD
fi
if [ -f $HOME/.kshrc -a -r $HOME/.kshrc ]; then
    ENV=$HOME/.kshrc    # set ENV if there is an rc file
    export ENV
fi
# If job control is enabled, set the suspend character to ^Z (control-z):
case $- in
*m*) stty susp '^z'
    ;;
esac
set -o ignoreeof # don't let control-d logout
PS1="$ "
export PS1
export ENV=$HOME/.kshrc
::::::::::::::
/home/users/e/ejray/.kshrc
::::::::::::::
#
# If there is no VISUAL or EDITOR to deduce the desired edit
#  mode from, assume vi(C)-style command line editing.
if [ -z "$VISUAL" -a -z "$EDITOR" ]; then
    set -o vi
fi
/etc/ksh.kshrc: No such file or directory
$

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.131.238