Single command to create a file and set its permission

后端 未结 8 1167
北恋
北恋 2021-01-31 08:23

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

My question is that w

8条回答
  •  情话喂你
    2021-01-31 08:46

    You can create your own command:

    create () {
        touch "$1"
        chmod "$2" "$1"
    }
    
    create filename.ext 644
    

提交回复
热议问题