mirror of
https://github.com/reactos/reactos.git
synced 2024-11-18 21:13:52 +00:00
e5c0c7185e
svn path=/trunk/; revision=2456
67 lines
1.8 KiB
Text
67 lines
1.8 KiB
Text
#/bin/sh
|
|
#
|
|
prefix=/usr/local
|
|
if test -n `echo $prefix | grep prefix`; then
|
|
prefix=/usr/local
|
|
fi
|
|
if test x$BASH = x; then
|
|
BASHRC=
|
|
else
|
|
BASHRC=~/.bashrc
|
|
fi
|
|
if test "x$EUID" = x0; then
|
|
PROFILE=/etc/profile
|
|
else
|
|
PROFILE=~/.profile
|
|
fi
|
|
if test -f $PROFILE; then
|
|
A=`grep "mc ()" $PROFILE`
|
|
B=
|
|
if test -n "$BASHRC"; then
|
|
if test -f $BASHRC; then
|
|
B=`grep "mc ()" $BASHRC`
|
|
fi
|
|
fi
|
|
if test -n "$A"; then
|
|
:
|
|
else
|
|
if test -n "$B"; then
|
|
:
|
|
else
|
|
A=`typeset -f | grep "mc ()" 2>/dev/null`
|
|
if test ! -n "$A"; then
|
|
echo "mc () installation."
|
|
if test -n "$BASHRC"; then
|
|
echo "While examining your $PROFILE and $BASHRC,"
|
|
else
|
|
echo "While examining your $PROFILE,"
|
|
fi
|
|
echo "I've found that you have no mc () function defined there."
|
|
echo "This function enables a feature of mc(1) that when you leave mc(1),"
|
|
echo "you return to a directory where you were in mc just before exiting"
|
|
echo "and not to the directory you've started mc from."
|
|
echo "Would you like to append"
|
|
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };'
|
|
if test -n "$BASHRC"; then
|
|
echo "function to your (p) $PROFILE (mc function will be active in your login shells)"
|
|
echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] "
|
|
else
|
|
echo -n "function to your $PROFILE? [y|n] "
|
|
fi
|
|
read rep
|
|
if test -n "$BASHRC"; then
|
|
INITFILE=$BASHRC
|
|
else
|
|
INITFILE=$PROFILE
|
|
fi
|
|
case $rep in
|
|
[Nn]*) exit ;;
|
|
[Pp]*) INITFILE=$PROFILE ;;
|
|
esac
|
|
echo >>$INITFILE
|
|
echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE
|
|
echo "mc () function appended to your $INITFILE"
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|