APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS









Linux Skills Test

Copyright 2002,2003 A.P. Lawrence


Answer


False

In general, I don't like recommending ZZ to new users For one thing, it's all too easy to hit CTRL-Z instead while reaching for Shift, and new users will think they have written their file rather than just put the vi process in background.

There's a more serious problem with ZZ if you happen to use

:w copyofthis

Follow that with ZZ and you don't write what you think you did: you write "copyofthis" instead. Example

vi /tmp/t 
a whatever (escape) 
:w /tmp/copy 
ZZ 

will leave /tmp/t empty.

Some older versions of vi had an even nastier problem with ZZ: if the file were write only, ZZ would just exit with no warning that you hadn't written. I'm pretty sure you won't see that except on something very old, but it could be out there.

Anyway, ":wq" is much safer than ZZ

Comments /Tests/Linux/e0815.html


Add your comments


Next question
Return to Question q0815

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.