I tried to export some variable.

I create file .bash_profile and put inside export SPRING_PROFILES_ACTIVE=local

After it I reboot my ubuntu, login, but nothing happens.

My system is fresh ubuntu 18.04.

What I do wrong?


Probably not what you're looking for, but I don't believe .bash_profile exists. Try adding that export command to .profile instead.

Aka, echo "export SPRING_PROFILES_ACTIVE=local" >> .profile

(Tested on Debian Stretch; I don't use Ubuntu, but the fact you said "I create .bash_profile" is odd)

  • That worked? I thought (after posting) that maybe Ubuntu used a different layout than Debian and my answer was wrong. Apparently not. – Shadowcoder Jul 30 '18 at 19:40
  • 1
    BTW, Debian Stretch: root account: cd ~ && ls -la .bash_profile return: /bin/ls: cannot access '.bash_profile': No such file or directory ;) – Alex Jul 30 '18 at 19:41
  • this works for me – Vova Yatsyk Jul 30 '18 at 19:47
  • This answer contradicts the other answer on the page (which talks about the well-known .bash_profile file, and has more upvotes). This answer also contradicts man bash, section "INVOCATION", which talks about running .bash_profile on startup. Presumably this answer is, in some way, wrong, but switching from .bash_profile to .profile happens to work for some as-yet-unexplained reason. Does anyone have any idea what's going on here? – Jonathan Hartley Sep 21 '18 at 18:36
  • Ah. The GUI login shell on Ubuntu is 'Dash', not Bash. Described here – Jonathan Hartley Sep 22 '18 at 1:57

For your reference:

Below is login shell startup file processing diagram for different shells


(Credit for diagram is going to Shantanu Kulkarni who posted it in yEd gallery)

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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