老师,怎么修改vim /etc/profile
来源:12-2 线上服务器环境搭建
TheBayMax
2017-10-09
vim /etc/profile
E325: ATTENTION Found a swap file by the name "/etc/.profile.swp" owned by: root dated: Mon Oct 9 18:33:52 2017 file name: /etc/profile modified: YES user name: root host name: iZuf6c3lh54r8qj8l3o6zlZ process ID: 7949 While opening file "/etc/profile" dated: Mon Oct 9 19:41:56 2017 NEWER than swap file! (1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r /etc/profile" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/etc/.profile.swp" to avoid this message. Swap file "/etc/.profile.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
按enter后,出现
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`/usr/bin/id -u`
UID=`/usr/bin/id -ru`
fi
USER="`/usr/bin/id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi
HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
unset i
unse t-f pathmunge
rt NODE_HOME=/user/local/node-v4.4.7-linux-x64
export NODE_HOME=/user/local/node-v4.4.7-linux-x64
export PATH=$PATH:/user/local/bin:$NODE_HOME/bin强制改成了这样
unset i unse t-f pathmunge r rt NODE_HOME=/usr/local/node-v4.4.7-linux-x64 export NODE_HOME=/usr/local/node-v4.4.7-linux-x64 export PATH=$PATH:/usr/local/bin:$NODE_HOME/bin
提示这个:
E45: 'readonly' option is set (add ! to override)
是要删了重建吗,怎么弄呢
写回答
1回答
-
TheBayMax
提问者
2017-10-09
root权限登录,vi /etc/profile 亲测可用
012017-10-10
相似问题