简体   繁体   中英

Log: "bash: export: "PATH.": not a valid identifier" when opening terminal on Ubuntu

Whenever I open a terminal, a message appear on top of it saying what I wrote in the title. I think I messed up with the /etc/profile file when trying to get maven work. I read some infos on exporting variables, but couldn't find my error, since I followed a guide that worked fine for other people.

The profile file I mentioned has these lines at bottom:

JAVA_HOME=/usr/local/java/jdk1.8.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.8.0
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Setting $JAVA_HOME let me use properly Maven, but creates this annoying message. Can you help me?

As others mentioned in the comments, you are trying to export PATH. instead of PATH somewhere. You might want to check /etc/profile , ~/.bashrc and ~/.bash_profile files and try to find this invalid export.

The source you provided is technically ok and you don't need to add any $ signs. Your PATH will contain $HOME/bin value twice though. You might want to change it to look like this:

export JAVA_HOME=/usr/local/java/jdk1.8.0
export JRE_HOME=/usr/local/java/jre1.8.0
export PATH="$PATH:$HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM