PDA

View Full Version : [ubuntu] [SOLVED] Problem with vi - !quit command doesn't work


Tomas123
July 14th, 2008, 01:27 PM
Yesterday I installed Ubuntu Server 8.04.1 and noticed interesting problem with vi:

after making some changes I tried to quit vi with the command !quit in order to override all changes. This is what I would get an the screen:

:!quit
[No write since last change]
/bin/bash: quit: command not found
shell returned 127
Press ENTER or type command to continue
--------------------------------------------

after pressing ENTER I would be forwarded back to the editing screen. If I would try to quit with just :q command, I would get this error:

E37: No write since last change (add ! to override)

The only way to escape from that situation was with :wq command, which of course will save the changes...

Is this a bug?

Simon2006
July 14th, 2008, 01:34 PM
No bug, you need to put the ! after the 'quit' (or just use 'q!')

Putting an exclamation mark before the command tries to execute a bash command. For example, try !ls and it will list the contents of the current directory.

Tomas123
July 14th, 2008, 01:49 PM
Thanks Simon! Really that was a dumb mistake from my side... Sorry :) just 2nd month with linux...