如何在 vi 中更改文件权限 [英] How to change file permission from within vi

查看:27
本文介绍了如何在 vi 中更改文件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时在 vi 中打开只读文件,在打开它之前忘记执行 chmod +w.有没有办法从vi中更改文件?

I sometimes open a read-only file in vi, forgetting to do chmod +w before opening it. Is there way to change the file from within vi?

类似于!r chmod +w [文件名]?

是否有一个快捷方式来引用当前打开的文件而不拼写它的长名称?

Is there a shortcut to refer to the currently open file without spelling it's long name?

推荐答案

就用

:!chmod +w %

在命令模式下.% 将被当前文件名替换.

in command mode. % will be replaced by the current file name.

这篇关于如何在 vi 中更改文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆