7

I have an open terminal in ubuntu lucid in which I need a new env variable set.So,I open the .bashrc file and edit it ,to add the new env variable( say PYTHONPATH)

.bashrc

PYTHONPATH=/some/path
export PYTHONPATH

But,in order to get this effective ,I need to close my terminal and open it again.Is there some command with which I can get this effect,without close/open the terminal again.

damon
  • 8,127
  • 17
  • 69
  • 114

2 Answers2

17

Take a look at the source command: man source

source ~/.bashrc

Apart from that: why don't you simply use the environment commands directly in your shell to set an additional environment variable?

export PYTHONPATH="/some/path"

That way the created variable is effective right away.

arkascha
  • 41,620
  • 7
  • 58
  • 90
  • thanks @arkascha ,learned something good today.. you are right .it can be done in both ways – damon May 31 '13 at 06:25
1

You can also try,

sat:~# . ~/.bashrc 
sat
  • 14,589
  • 7
  • 46
  • 65
  • `.` is POSIX-compliant, `source` is not. This should be the accepted and most-upvoted answer :) –  Dec 18 '22 at 23:55