4 ms·
Why I do 'touch' first: I'm in vim creating the file, then I try to save and discover I don't have write permissions [1]. With a touch first, saving the file a
by EarthLaunch 5y ago
Why I do 'touch' first: I'm in vim creating the file, then I try to save and discover I don't have write permissions [1].
With a touch first, saving the file always works.
1: https://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/ https://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-w...
- koyote 5y agoThat's a good tip! Sadly it does not save me from going and editing a system file as non-root and then trying to save... :(
- michaelmrose 5y agoYou could have a function that writes contents of buffer to current path as root in your editor of choice.