Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 623
ricardoramos Avatar asked Aug 11 '15 17:08

ricardoramos


People also ask

What is ETC environment file?

/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.


1 Answers

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.

like image 133
mattias Avatar answered Nov 01 '22 12:11

mattias