Thursday, October 9, 2008
Have you ever faced the situation when you edited a file in vim editor and the time you tried to save, you realized the file is read only for you, so what you do that time ?
a) you just exit without saving; change the permission of the file, then edit the file again in vim and then save
b) from another terminal you change the permission of the file, and do the save and exit
This is what I do in this situation:
There is an command in vi to create a new shell from vi , its called sh. So go to ex mode and type
sh looks up the user's default shell (e.g. the Bourne shell or the C shell) and starts a new shell. In that shell change the permission of the file, type exit, you will be in the same vi session; now save your file.
© Jadu Saikia www.UNIXCL.com