home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / mc454src.zip / mc-4.5.4.src / mc-4.5.4 / mcfn_install.in < prev    next >
Text File  |  1999-01-04  |  2KB  |  68 lines

  1. #/bin/sh
  2. #
  3. prefix=@prefix@
  4. if test -n `echo $prefix | grep prefix`; then
  5.     prefix=/usr/local
  6. fi
  7. if test x$BASH = x; then
  8.     BASHRC=
  9. else
  10.     BASHRC=~/.bashrc
  11. fi
  12. if test "x$EUID" = x0; then
  13.     PROFILE=/etc/profile
  14. else
  15.     PROFILE=~/.profile
  16. fi
  17. if test -f $PROFILE; then
  18.     A=`grep "mc ()" $PROFILE`
  19.     B=
  20.     if test -n "$BASHRC"; then
  21.     if test -f $BASHRC; then
  22.         B=`grep "mc ()" $BASHRC`
  23.     fi
  24.     fi
  25.     if test -n "$A"; then
  26.     :
  27.     else 
  28.         if test -n "$B"; then
  29.         :
  30.     else
  31.             A=`typeset -f | grep "mc ()" 2>/dev/null`
  32.         if test ! -n "$A"; then
  33.             echo "mc () installation."
  34.         if test -n "$BASHRC"; then
  35.             echo "While examining your $PROFILE and $BASHRC,"
  36.         else
  37.                 echo "While examining your $PROFILE,"
  38.         fi
  39.         echo "I've found that you have no mc () function defined there."
  40.         echo "This function enables a feature of mc(1) that when you leave mc(1),"
  41.         echo "you return to a directory where you were in mc just before exiting"
  42.         echo "and not to the directory you've started mc from."
  43.             echo "Would you like to append"
  44.             echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };'
  45.         if test -n "$BASHRC"; then
  46.                 echo "function to your (p) $PROFILE (mc function will be active in your login shells)"
  47.             echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] "
  48.         else
  49.                 echo -n "function to your $PROFILE? [y|n] "
  50.         fi
  51.             read rep
  52.         if test -n "$BASHRC"; then
  53.             INITFILE=$BASHRC
  54.         else
  55.             INITFILE=$PROFILE
  56.         fi
  57.             case $rep in
  58.             [Nn]*) exit ;;
  59.             [Pp]*) INITFILE=$PROFILE ;;
  60.             esac
  61.                 echo >>$INITFILE
  62.             echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE
  63.             echo "mc () function appended to your $INITFILE"
  64.         fi
  65.         fi 
  66.     fi
  67. fi
  68.