早教吧 育儿知识 作业答案 考试题库 百科 知识分享

linuxvi打开文件出现的信息是什么意思?要怎么操作Whileopeningfile"test.txt"dated:SunApr1320:13:402014NEWERthanswapfile!(1)Anotherprogrammaybeeditingthesamefile.Ifthisisthecase,becarefulnottoendupwithtwodi

题目详情
linux vi打开文件出现的信息是什么意思?要怎么操作
While opening file "test.txt"
dated:Sun Apr 13 20:13:40 2014
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 test.txt"
to recover the changes (see ":help recovery").
If you did this already,delete the swap file ".test.txt.swp"
to avoid this message.
Swap file ".test.txt.swp" already exists!
[O]pen Read-Only,(E)dit anyway,(R)ecover,(D)elete it,(Q)uit,(A)bort:
-- More --
▼优质解答
答案和解析
用vi编辑文件(如这里的test.txt)时,系统会自动产生一个文件叫.test.txt.swp.如果正常退出,此文件会被自动删去.如果上次非正常退出,如果再编辑它,系统会首先查.test.txt.swp
是否存在,如果存在,就会问你如何处理.选择在结尾:
O:read-only,只读,不能改
E:可以改,从前的修改都丢失
R:恢复(从前的修改)
D:删去(我没用过,估计是删去.test.txt.swp)
Q:退出(什么也不做)
A:半途放弃(没用过)
最重要的问题是:是否有另外的应用在使用此文件?如果是,最好先找出(用fuser命令),再决定如何处理.