单个命令创建文件并设置其权限 [英] Single command to create a file and set its permission

查看:65
本文介绍了单个命令创建文件并设置其权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下2条命令创建一个0B文件并将其extn设置为644

I am using the following 2 commands to create a 0B file and set its extn to 644

touch filename.ext
chmod 777 filename.txt

我的问题是,unix(korn shell)中是否有任何一个命令可以同时完成这两项工作,即创建具有所需权限的0B fil?

My question is that whether there is any single command in unix (korn shell) that will do the two things together that is to say create a 0B fil with desired permission?

推荐答案

install -m 777 /dev/null filename.txt

这篇关于单个命令创建文件并设置其权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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