Unix - create path of folders and file

后端 未结 11 2017
面向向阳花
面向向阳花 2020-12-22 18:20

I know you can do mkdir to create a directory and touch to create a file, but is there no way to do both operations in one go?

i.e. if I wa

11条回答
  •  温柔的废话
    2020-12-22 18:53

    Do it with /usr/bin/install:

    install -D /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
    

    when you don't have a source file:

    install -D <(echo 1) /my/other/path/here/cpedthing.txt
    

提交回复
热议问题