home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / pdksh-4.9-src.lha / GNU / src / amiga / pdksh-4.9 / etc / ksh.kshrc next >
Encoding:
Text File  |  1994-05-04  |  2.6 KB  |  127 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.6 93/09/29 08:57:50 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.         ilabel () { print -n "${ILS}$*${ILE}"; }
  85.         label () { print -n "${WLS}$*${WLE}"; }
  86.  
  87.         alias stripe='label "$USER@$HOST ($tty) - $PWD"'
  88.         alias istripe='ilabel "$USER@$HOST ($tty)"'
  89.  
  90.         wftp () { ilabel "ftp $*"; "ftp" $*; eval istripe; }
  91.         wcd () { "cd" $*; eval stripe; }
  92.         wtelnet ()
  93.         {
  94.             "telnet" "$@"
  95.             eval istripe
  96.             eval stripe
  97.         }
  98.         wsu ()
  99.         {
  100.             "su" "$@"
  101.             eval istripe
  102.             eval stripe
  103.         }
  104.         alias su=wsu
  105.         alias cd=wcd
  106.         alias ftp=wftp
  107.         alias telnet=wtelnet
  108.         eval stripe
  109.         eval istripe
  110.         PS1=$PROMPT
  111.     fi
  112.     alias quit=exit
  113.     alias cls=clear
  114.     alias logout=exit
  115.     alias bye=exit
  116.     alias p='ps -l'
  117.     alias j=jobs
  118.     alias o='fg %-'
  119.  
  120.  
  121. # add your favourite aliases here
  122. ;;
  123. *)    # non-interactive
  124. ;;
  125. esac
  126. # commands for both interactive and non-interactive shells
  127.