HOME/bin 不是有效标识符

HOME/bin 不是有效标识符

我是一名研究生,一直在维护一台 Linux-Ubuntu 机器上的服务器 - 我们在 Ontopia 和 Wandora 上工作,这两个程序喜欢干扰 Java 环境。我边学边做,这意味着我可能搞砸了一些愚蠢的事情;我相信我在尝试更新 Ubuntu 上运行的 Java 版本时弄坏了它。

登录页面加载,我输入密码,它重新加载。所有用户、访客和测试帐户都会发生这种情况。Ubuntu、Ubuntu2d、lubuntu 和 graphicx 故障安全恢复业务之后都会发生这种情况。

通过 shell 登录(按 Alt F3 之后)得到:

-bash: export: 'HOME/bin' : not a valid identifier

但让我浏览系统和帐户时没有其他明显问题。我的.xsession-errors给出:

/etc/gdm/Xsession: 3: export: HOME/bin: bad variable name

当我输入时which java我得到:

/usr/lib/jvm/java-6-openjdk-amd64//bin/java

我知道这可能会导致什么问题,但我不知道如何改变这条路径[并且在网上找不到在哪里可以做到这一点]。

我的环境文件包括我认为不相关的 CLASSPATH 和 CATALINA_HOME 变量,以及:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:"
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64:/usr/lib/jvm/java-6-openjdk-amd64
JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre:/usr/lib/jvm/java-6-openjdk-amd64/jre

内容java.sh

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$JAVA $HOME/bin

内容/etc/bashrc

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi

# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
    case " $(groups) " in *\ admin\ *)
    if [ -x /usr/bin/sudo ]; then
    cat <<-EOF
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.

    EOF
    fi
    esac
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
    function command_not_found_handle {
            # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
           /usr/bin/python /usr/lib/command-not-found -- "$1"
                   return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
           /usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"
                   return $?
        else
           printf "%s: command not found\n" "$1" >&2
           return 127
        fi
    }
fi

内容~/.profile

# ~/.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

您需要查看您的点文件(例如,如果您使用 bash,它将是 .bashrc、.bash_profile)以查找条目export PATH=....

从外观上看,其中一个条目将更HOME/bin改为$HOME/bin,注销并重新登录,错误应该消失

答案2

我认为问题出在这里:

/etc/gdm/Xsession: 3: export: HOME/bin: bad variable name

编辑 /etc/gdm/Xsession ( sudo nano /etc/gdm/Xsession) 然后转到第 3 行并更改HOME/bin$HOME/bin

相关内容