|
使用vim,错误出现原因一般为以下两种情况:
(1) 当你用多个程序编辑同一个文件时。
(2) 非常规退出时。
会提示以下信息:
E325: ATTENTION
Found a swap file by the name "/etc/systemd/system/.supervisor.service.swp"
owned by: root dated: Thu Jun 28 13:18:19 2018
file name: /etc/systemd/system/supervisor.service
modified: no
user name: root host name: VM_0_9_centos
process ID: 13409 (still running)
While opening file "/etc/systemd/system/supervisor.service"
(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/systemd/system/supervisor.service"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/systemd/system/.supervisor.service.swp"
to avoid this message.
Swap file "/etc/systemd/system/.supervisor.service.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: (1)(2)为官方给出的解决方法:
(1) 为了避免同一个文件产生两个不同的版本,还是建议选择"(Q)uit"或者继续谨慎修改选择"(E)dit anyway"。
(2) 也可以选择"(R)ecover"或"vim -r filename"恢复到未修改之前,然后再把swp文件删除(这个时候要确保你的swp文件没有用处了)。
最下面选项的意思:
O: 只读,不能改
E: 可以改,从前的修改都丢失
R: 恢复(从前的修改)
D: 删去(删去.swp文件,文件恢复到未修改前)
Q: 退出
A: 放弃
具体解决方案:
(1) 不想保留原先修改的内容直接选D就可以。
(2) 想保留原先修改的内容选R把修改的内容复制出来保存,再退出文件删除awp文件。(awp文件默认为隐藏文件,用ls -a命令查看,用rm命令删除。)
如果这种情况 ,无论你选择哪一个选项,下次进入依然会出现这样的提示,这个问题的原因在于,异常退出后,linux会针对这个文件生成一个swp文件,下次再次编辑会判断如果有这个文件就会依然提示,如果你没有要还原旧文件内容的打算,就直接把这个文件删除,提示就不会再出现了。
在当前目录下面执行ll命令是看不见这个文件的,可以直接执行命令:
|
上一篇:ASP.NET Core命令行创建mvc项目下一篇:【实战】Centos 7 .Net core后台守护进程Supervisor教程
|