Saturday, October 23, 2010

Start a new shell from Vi editor in emergency !!

Have you ever faced a situation where you unfortunately edited a Read-only file and later realized that either you need to start a duplication putty session to make that file chmod +w or come out from vi editor without saving the data.

If you know this probably you can handle this situation better that to very fast in efficiently!

How:

While being on the bash Vim editor itself go to the command mode and type -

:sh

sh will look 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(ctrl+d), you will be in the same vi session; now save your file.

Enjoy!
DK

No comments:

Post a Comment

CICD Assessment

( A story on -  how we formulated a process around measuring and achieving CICD, and  how these journey lines has now become a means t...