home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / W2KPRK.iso / apps / posix / source / SH / ETC / KSH.KSHRC next >
Text File  |  1999-11-17  |  2KB  |  104 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. # AMENDED:
  19. #    91/11/12 19:39:44 (sjg)
  20. #
  21. # RELEASED:
  22. #    91/11/12 19:39:46 v2.4
  23. #
  24. # SCCSID:
  25. #    @(#)ksh.kshrc 2.4 91/11/12 19:39:44 (sjg)
  26. #
  27. #    @(#)Copyright (c) 1991 Simon J. Gerraty
  28. #
  29. #    This file is provided in the hope that it will
  30. #    be of use.  There is absolutely NO WARRANTY.
  31. #    Permission to copy, redistribute or otherwise
  32. #    use this file is hereby granted provided that 
  33. #    the above copyright notice and this notice are
  34. #    left intact. 
  35.  
  36. case "$-" in
  37. *i*)    # we are interactive
  38.     # we may have su'ed so reset these
  39.     # NOTE: SCO-UNIX doesn't have whoami,
  40.     #    install whoami.sh
  41.     USER=`whoami`
  42.     PROMPT="<$USER@$HOSTNAME:!>$ "
  43.     PPROMPT='<$USER@$HOSTNAME:$PWD:!>$ '
  44.     PS1=$PPROMPT
  45.     # $TTY is the tty we logged in on,
  46.     # $tty is that which we are in now (might by pty)
  47.     tty=`tty`
  48.     tty=`basename $tty`
  49.  
  50.     set -o $EDITOR
  51.  
  52.     alias ls='ls -CF'
  53.     alias h='fc -l | more'
  54.     # the PD ksh is not 100% compatible
  55.     case "$KSH_VERSION" in
  56.     *PD*)    # PD ksh
  57.         builtin=builtin
  58.             bind ^?=delete-char-backward
  59.             bind ^[^?=delete-word-backward
  60.         ;;
  61.     *)    # real ksh ?
  62.         builtin=""
  63.         ;;
  64.     esac
  65.     case "$TERM" in
  66.     sun*)
  67.         # these are not as neat as their csh equivalents
  68.         if [ "$tty" != console ]; then
  69.             ilabel () { print -n "\033]L$*\033\\"; }
  70.             label () { print -n "\033]l$*\033\\"; }
  71.             alias stripe='label $USER @ $HOSTNAME \($tty\) - $PWD'
  72.             cds () { "cd" $*; eval stripe; }
  73.             alias cd=cds
  74.             eval stripe
  75.             eval ilabel "$USER@$HOSTNAME"
  76.             PS1=$PROMPT
  77.         fi
  78.         ;;
  79.     xterm*)
  80.         # these are not as neat as their csh equivalents
  81.         ilabel () { print -n "\033]1;$*\007"; }
  82.         label () { print -n "\033]2;$*\007"; }
  83.         alias stripe='label xterm: $USER @ $HOSTNAME \($tty\) - $PWD'
  84.         cds () { "cd" $*; eval stripe; }
  85.         alias cd=cds
  86.         eval stripe
  87.         eval ilabel "$USER@$HOSTNAME"
  88.         PS1=$PROMPT
  89.         ;;
  90.     *)    ;;
  91.     esac
  92.     alias quit=exit
  93.     alias cls=clear
  94.     alias logout=exit
  95.     alias bye=exit
  96.  
  97.  
  98. # add your favourite aliases here
  99. ;;
  100. *)    # non-interactive
  101. ;;
  102. esac
  103. # commands for both interactive and non-interactive shells
  104.