Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I added to the path in ~/.profile and the path will be updated if I

source ~/.profile

but on system restart, ~/.profile is not loaded. How can I make it automatic so I don't have to source it? Is ~/.profile the right place to add to the path for something like grails bin?

share|improve this question

migrated from stackoverflow.com Dec 16 '12 at 22:30

This question came from our site for professional and enthusiast programmers.

2  
Which shell are you using? Bourne, Korn and Bash shells normally read ~/.profile. –  Jonathan Leffler Dec 16 '12 at 21:44
    
@JonathanLeffler: Not "on system restart" they don't. –  Johnsyweb Dec 16 '12 at 21:47
    
I am using bash –  Allison Eer Dec 16 '12 at 21:51
    
Please explain what you mean by 'on system restart', and the context in which the ~/.profile is not being read. Do you mean that it is not read by the shell in your terminal window? Or something else? Have you configured your terminal window to run a login shell? –  Jonathan Leffler Dec 16 '12 at 22:09
    
"on system restart": when I restart my computer. If I do echo $PATH in the terminal, the updates to the path are not there. What is a login shell? I don't think I have reconfigured my terminal window in that way. –  Allison Eer Dec 16 '12 at 22:18

2 Answers 2

up vote 2 down vote accepted

You need to invoke bash with either -l or --login to make it a login shell, one that looks for and reads ~/.profile. For more, refer to the INVOCATION section in man bash.

If there's something you want bash to run every time, not just when you make it a login shell, put that into ~/.bashrc, not ~/.profile.

If you're trying to decide what should go where, put stuff that can be inherited, e.g., environment variable settings into ~/.profile and stuff that can't, like alias definitions into ~/.bashrc.

share|improve this answer

Just a wild guess as you do not state what OS you are running.

Assuming you are running a CDE desktop, make sure you have a line that reads

DTSOURCEPROFILE=true

at the end of your ~/.dtprofile

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.