0

I set an environmental variable for user on CentOS by simply:

1.) Logging in with the user

2.) Going to their home directory cd ~ and creating a file .profile

3.) Putting the following in the .profile file:

export APP="dev"

However, when I:

echo $APP

It is blank. I have tried closing my SSH session and retying, still the same problem.

Justin
  • 5,328
  • 19
  • 64
  • 84

2 Answers2

3

~/.profile is only read for login shells. Either use ~/.bashrc for all bash shells, or ~/.ssh/rc for SSH connections only.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84
0

you can place myenv.sh in /etc/profile.d directory

in myenv.sh you can have the following line

export APP="dev"

it is working

K Adithyan
  • 101
  • 1