how to read an enviroment variable declared in /etc/environment from bash?

Solution 1:

If you are using the bash shell

. /etc/environment

without the dot the variables defined in the script file are not passed to your current shell.

For Example:

$ cat b.sh
TRAVERSE="Another SomeThing"
$ echo $TRAVERSE

$ ./b.sh
$ echo $TRAVERSE

$ . ./b.sh
$ echo $TRAVERSE
Another SomeThing
$