1

How do I read or access the TRAVERSE environment variable below?

nicholas@gondor:~$ 
nicholas@gondor:~$ printenv | grep PATH
WINDOWPATH=2
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
nicholas@gondor:~$ 
nicholas@gondor:~$ printenv | grep TRAVERSE
nicholas@gondor:~$ 
nicholas@gondor:~$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

TRAVERSE="/home/nicholas/some_directory" nicholas@gondor:~$

I ran source ~/.bashrc without result. I expect that if I were to reboot the variable would be readable, but that seems extreme.

see also:

https://stackoverflow.com/q/39296472/4531180

1 Answers1

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 $

SEWTGIYWTKHNTDS
  • 387
  • 1
  • 7