加载 .profile 时出错

加载 .profile 时出错

这是我的 .bashrc

# LD_LIBRARY_PATH
OTCL_LIB=/home/shabeer/ns-allinone-2.35/otcl-1.14
NS2_LIB=/home/shabeer/ns-allinone-2.35/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/home/shabeer/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/shabeer/ns-allinone-2.35/bin:/home/shabeer/ns-allinone-
2.35/tcl8.5.10/:/home/shabeer/ns-allinone-2.35/tk8.5.10/

#the above two lines beginning from xgraph and ending with unix should come on the same line

#NS=/home/shabeer/ns-allinone-2.35/ns-2.35/
#NAM=/home/shabeer/ns-allinone-2.35/nam-1.15/
#PATH=$PATH:$XGRAPH:$NS:$NAM

XGRAPH=/home/shabeer/ns-allinone-2.35/bin:/home/shabeer/ns-allinone-2.35/tcl8.5.10/:/home/shabeer/ns-allinone-2.35/tk8.5.10/
NS=/home/shabeer/ns-allinone-2.35/ns-2.35/
NAM=/home/shabeer/ns-allinone-2.35/nam-1.15/
export PATH=$PATH:$XGRAPH:$NS:$NAM

每次我第一次登录时,我的 ubuntu 14.04 都会给我一个错误消息“在加载 /home/shabeer/.profile 时发现错误,错误出现在 bashrc 第 15 行,请尽快修复它....我该如何解决这个问题。

这是我的个人资料。

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

答案1

从 14.04 升级到 14.10 时,我遇到了同样的错误。我通过重置我的个人资料解决了这个问题。

要恢复默认的 ~/.profile,请使用:

cp /etc/skel/.profile ~/.profile

答案2

你的 .bashrc 中有以下内容:

# PATH
XGRAPH=/home/shabeer/ns-allinone-2.35/bin:/home/shabeer/ns-allinone-
2.35/tcl8.5.10/:/home/shabeer/ns-allinone-2.35/tk8.5.10/

但应该有 1 行被分成了 2 行。尝试:

# PATH
XGRAPH=/home/shabeer/ns-allinone-2.35/bin:/home/shabeer/ns-allinone-2.35/tcl8.5.10/:/home/shabeer/ns-allinone-2.35/tk8.5.10/

相关内容