As far as I know PATH is not a temporary variable. And when you reopen your terminal it should work as before. In my case it's not.
What I do is to add another path to $PATH
:
export PATH=$PATH:/usr/local/go/bin
It should append go
dir to PATH
variable and it does do that, but when I reopen terminal and echo $PATH
my last appended path is cleared and I have my paths without /usr/local/go/bin
at the end.
What is the reason this is happening? Is there something I'm doing wrong?
Put your permanent path changes into your .profile "reopening" is starting another terminal from scratch, and it get the PATH from the system (or your) PATH setups, not from some past session.
Variables are not temporary or persistent by nature, but you can change them either temporarily or persistently. It's well explained in the tutorial EnvironmentVariables.