2

I've been trying to work out how to edit the bash profile for the login shell in Ubuntu 18.04. Being new to linux and the forum being my friend, i found that it is located in .profile as oppose to bash_profile previously. I'm not sure which profile i should be amending as i cannot find bash_profile.

I'm trying to add a line for virtualenvwrapper so that it can be sourced every time a new terminal session is launched but it isn't working.

nano .profile

Then adding...

source .local/bin/virtualenvwrapper.sh

to the end

Saved and exited but it doesn't work. Have i missed something or do i have to add anything in the script?

Thanks as always.

Maverick32
  • 197
  • 1
  • 3
  • 11
  • Thanks - this has given me a better understanding but this wouldn't be an alias, it would be for the login shell which is bash_profile but cannot find this. So i presumed this would be .profile ? – Maverick32 Mar 31 '19 at 10:27
  • If you create a ~/.bash_profile, it will be read in preference to ~/.profile - if you don't, then ~/.profile will be used. Neither will be used for a non-login shell - which is typically what is executed by terminal emulators (not sure whether that's relevant here - it depends what you mean by "terminal session") – steeldriver Mar 31 '19 at 13:23

1 Answers1

1
  • How to fix current problem:
    • $ echo "export PATH="$HOME/.local/bin/:$PATH"" >> .profile and then log in and out. You will now be able to run $ virtualenvwrapper.sh from the Terminal.
  • What I would recommend in stead:
    • Put your virtualenvwrapper.sh in ~/bin. ~/bin is the Unix standard place to put your personal scripts that you want added to your shell (Terminal). If you don't already have a ~/bin you can create it. If you look in ~/profile, you should see PATH="$HOME/bin:$PATH". That line adds the files in ~/bin into your shell so you can execute them just like other programs installed on your system. I would also rename virtualenvwrapper.sh to virtualenvwrapper because other wise ever time you run it from the terminal it will have the .sh at the end. It looks more like the other commands you have installed if you remove the file extension. Not to worry though, removing the file extension dose not change how the program is executed. I have a few scripts installed like this and this is what I found works.
9716278
  • 126