linux下vi編輯某文件時,操作出現 錯誤提示: E325: ATTENTION 2, Found a swap file by the name ".p1.c.swp"


當我在linux下用vi打開p1.c文件時

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指針# vi p1.c

會出現如下信息:

 1 E325: ATTENTION
 2 Found a swap file by the name ".p1.c.swp"
 3           owned by: root   dated: Fri Jan  5 19:57:58 2018
 4          file name: ~root/1/01/指針/p1.c
 5           modified: YES
 6          user name: root   host name: iZ2zeeailqvwws5dcuivdbZ
 7         process ID: 10876
 8 While opening file "p1.c"
 9              dated: Fri Jan  5 19:51:30 2018
10 
11 (1) Another program may be editing the same file.  If this is the case,
12     be careful not to end up with two different instances of the same
13     file when making changes.  Quit, or continue with caution.
14 (2) An edit session for this file crashed.
15     If this is the case, use ":recover" or "vim -r p1.c"
16     to recover the changes (see ":help recovery").
17     If you did this already, delete the swap file ".p1.c.swp"
18     to avoid this message.
19 
20 Swap file ".p1.c.swp" already exists!
21 [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 
上面的兩段話(1)(2)的翻譯是:
(1)另一個程序可能正在編輯同一個文件。 如果是這種情況,請注意在進行更改時不要以相同文件的兩個不同實例結束。 退出,或繼續謹慎。
(2)此文件的編輯會話崩潰。如果是這種情況,請使用“:recover”或“vim -r p1.c”來恢復更改(請參閱“:help recovery”)。如果已經這樣做, 刪除交換文件“.p1.c.swp”以避免此消息。

原因是我之前有一次使用vi 操作 p1.c 文件時出現了異常中斷,與服務器中斷連接了,所以我重新連接服務器后,用 i p1.c 查看時,在當前目錄下產生了一個 .p1.c.swp 文件。

但是我使用ls命令查看該目錄下,卻發現沒有這個文件,后來使用ls -a命令查看才知道 .p1.c.swp 是一個隱藏文件。

注:以.開頭的文件就是隱藏文件哦。

當我把該隱藏文件刪除后再次打開就沒有上面的警告了。

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指針# rm .p1.c.swp

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指針# 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM