ricardoramos
ricardoramos

Reputation: 946

how to properly edit the /etc/environment file?

I'm trying to transfer my end of environment variables .bashrc file to the end of the /etc/environment file.

But every time I change this file can not login on the computer and to undo the changes through the display mode CTRL+ALT+F2, then to save time, I wonder if my configuration is correct before restarting my computer .

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-oracle/​"
CLASSPATH="JAVA_HOME/lib/:$CLASSPATH"
PATH="$JAVA_HOME/bin/:$PATH"
M2_HOME="/usr/share/maven/"
M2="$M2_HOME/bin"
PATH="$M2:$PATH"

I made the changes as root, it is correct the way edited /etc/environment the file?

Upvotes: 16

Views: 48515

Answers (1)

mattias
mattias

Reputation: 2108

You cannot reference previously defined variables in the same way as you would do in .bashrc in the /etc/environment. See this section of the Ubuntu Community Help wiki,

"It is not a script file, but rather consists of assignment expressions, one per line."

Also have a look at the following answer regarding syntax examples.

Upvotes: 13

Related Questions