start page | rating of books | rating of authors | reviews | copyrights

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 30.24 vi/ex File Recovery vs. Networked Filesystems Chapter 30
vi Tips and Tricks
Next: 30.26 Shell Escapes: Running One UNIX Command While Using Another
 

30.25 vi -r May not Write Recovered Buffer When You Exit

Usually, when you're editing a file with vi, if you type the command ZZ, it saves your file. But, on some versions of vi, if you recover a file with vi -r (30.24), typing ZZ may not save your edits!

That might be a good thing. When you recover a buffer, you need to decide whether the recovered buffer is really what you want. Maybe you've made other changes to the file since then. Maybe something went wrong as the buffer was being saved (say, the system crashed). You shouldn't just save without checking first.

You can use the :w! command to write the recovered version after you're sure that you want it. Use the :q! command if you don't want the recovered version.

- JP


Previous: 30.24 vi/ex File Recovery vs. Networked Filesystems UNIX Power ToolsNext: 30.26 Shell Escapes: Running One UNIX Command While Using Another
30.24 vi/ex File Recovery vs. Networked Filesystems Book Index30.26 Shell Escapes: Running One UNIX Command While Using Another

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System