I'm trying to edit .bash_profile
because I am installing the JDK on my Mac.
When trying to open up the file using vi ./.bash_profile
, it shows an error because there was a swp file of bash. It also said there may be someone editing it or that a past session crashed. It gives me options to edit, recover or delete. So I recovered it and got this:
Swap file "./.bash_profile.swp" already exists! "./.bash_profile" 2L, 87C
What does that mean and how do I move forward? I need to edit the file and put in this command
export PATH=$PATH:/Library/Java/JavaVirtualMachines/ jdk1.8.0_91.jdk/Contents/Home/bin
Best Answer
Open the file with vi (vim):
You will see a prompt like this:
Type the following at the prompt:
At the next prompt:
Type:
This will bring you into visual mode. Type:
:q!
to quit vim.
Now remove (unlink) the file .bash_profile.swp. You now can compare your original .bash_profile with savedfile and edit as necessary.