home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / sysutils / kornshel / ksh.ksh < prev    next >
Text File  |  1992-08-25  |  3KB  |  108 lines

  1. :
  2. # NAME:
  3. #    ksh.kshrc - global initialization for ksh
  4. #
  5. # DESCRIPTION:
  6. #    Each invocation of /bin/ksh processes the file pointed
  7. #    to by $ENV (usually $HOME/.kshrc).
  8. #    This file is intended as a global .kshrc file for the
  9. #    Korn shell.  A user's $HOME/.kshrc file simply requires
  10. #    the line:
  11. #        . /etc/ksh.kshrc
  12. #    at or near the start to pick up the defaults in this
  13. #    file which can then be overridden as desired.
  14. #
  15. # SEE ALSO:
  16. #    $HOME/.kshrc
  17. #
  18.  
  19. # RCSid:
  20. #    $Id: ksh.kshrc,v 1.3 1992/08/10 12:00:08 sjg Exp $
  21. #
  22. #    @(#)Copyright (c) 1991 Simon J. Gerraty
  23. #
  24. #    This file is provided in the hope that it will
  25. #    be of use.  There is absolutely NO WARRANTY.
  26. #    Permission to copy, redistribute or otherwise
  27. #    use this file is hereby granted provided that
  28. #    the above copyright notice and this notice are
  29. #    left intact.
  30.  
  31. case "$-" in
  32. *i*)    # we are interactive
  33.     # we may have su'ed so reset these
  34.     # NOTE: SCO-UNIX doesn't have whoami,
  35.     #    install whoami.sh
  36.     USER=`whoami`
  37.     PROMPT="<$USER@$HOSTNAME:!>$ "
  38.     PPROMPT='<$USER@$HOSTNAME:$PWD:!>$ '
  39.     PS1=$PPROMPT
  40.     # $TTY is the tty we logged in on,
  41.     # $tty is that which we are in now (might by pty)
  42.     tty=`tty`
  43.     tty=`basename $tty`
  44.  
  45.     set -o $EDITOR
  46.  
  47.     alias ls='ls -CF'
  48.     alias h='fc -l | more'
  49.     # the PD ksh is not 100% compatible
  50.     case "$KSH_VERSION" in
  51.     *PD*)    # PD ksh
  52.         case "$TERM" in
  53.         xterm*)
  54.             # bind arrow keys
  55.             bind '^[['=prefix-2
  56.             bind '^XA'=up-history
  57.             bind '^XB'=down-history
  58.             bind '^XC'=forward-char
  59.             bind '^XD'=backward-char
  60.             ;;
  61.         esac
  62.         ;;
  63.     *)    # real ksh ?
  64.         ;;
  65.     esac
  66.     case "$TERM" in
  67.     sun*)
  68.         # these are not as neat as their csh equivalents
  69.         if [ "$tty" != console ]; then
  70.             # ilabel
  71.             ILS='\033]L'; ILE='\033\\'
  72.             # window title bar
  73.             WLS='\033]l'; WLE='\033\\'
  74.         fi
  75.         ;;
  76.     xterm*)
  77.         ILS='\033]1;'; ILE='\007'
  78.         WLS='\033]2;xterm: '; WLE='\007'
  79.         ;;
  80.     *)    ;;
  81.     esac
  82.     # do we want window decorations?
  83.     if [ "$ILS" ]; then
  84.         wftp () { ilabel "ftp $*"; "ftp" $*; 
  85.             ilabel "$USER@$HOSTNAME"; }
  86.         wcd () { "cd" $*; eval stripe; }
  87.         ilabel () { print -n "${ILS}$*${ILE}"; }
  88.         label () { print -n "${WLS}$*${WLE}"; }
  89.         alias stripe='label $USER @ $HOSTNAME \($tty\) - $PWD'
  90.         alias cd=wcd
  91.         alias ftp=wftp
  92.         eval stripe
  93.         eval ilabel "$USER@$HOSTNAME"
  94.         PS1=$PROMPT
  95.     fi
  96.     alias quit=exit
  97.     alias cls=clear
  98.     alias logout=exit
  99.     alias bye=exit
  100.  
  101.  
  102. # add your favourite aliases here
  103. ;;
  104. *)    # non-interactive
  105. ;;
  106. esac
  107. # commands for both interactive and non-interactive shells
  108.