I have changed my environment variables before now. When I am trying to use the following command:
sudo vi /etc/environment
I am getting following warning/error and I am confused about what to do next.
E325: ATTENTION
Found a swap file by the name "/etc/.environment.swp"
owned by: root dated: Wed Apr 18 15:03:44 2018
file name: /etc/environment
modified: no
user name: root host name: my-desktop
process ID: 6410
[not usable on this computer]
While opening file "/etc/environment"
dated: Wed Apr 18 14:49:02 2018
(1) Another program may be editing the same file. If this is the
case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/environment"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.environment.swp"
to avoid this message.
"/etc/environment" 6 lines, 389 characters
Press ENTER or type command to continue
So can someone please explain to me what to do next and what this message really means?
UPDATE: I tried to do as suggested .I pressed e
and it opened the environment file then I pressed i
to edit it and changed my nodejs version (initially it was 9.x and I made it 8.x) then I pressed Esc
and then shift+;
and then wq|x
after that I finally pressed Enter
and it closes the vi editor after that again I ran the same command but it gave me same error but with further update stating NEWER than swap file!
Full message as follows:
E325: ATTENTION
Found a swap file by the name "/etc/.environment.swp"
owned by: root dated: Wed Apr 18 15:03:44 2018
file name: /etc/environment
modified: no
user name: root host name: my-desktop
process ID: 6410
[not usable on this computer]
While opening file "/etc/environment"
dated: Mon May 14 16:53:13 2018
NEWER than swap file!
(1) Another program may be editing the same file. If this is the
case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/environment"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.environment.swp"
to avoid this message.
"/etc/environment" 7 lines, 390 characters
Press ENTER or type command to continue
So don't know how to resolve it!