Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
想知道如果您想从 unix 中的另一个目录在某个目录中创建文件,代码会是什么样子。
例子:
File to be created: pop.txt Directory to create that in: /home/p1 Directory you are currently in and are to make it from: /home/pokemon/master/
谢谢
touch /home/p1/pop.txt
就这么简单
你可以使用这种方式。因为 touch 只创建一个空文件。但这您也可以添加内容。
猫 > /home/p1/pop.txt
vim > /home/p1/pop.txt
cat 用于终端。vim 是一个编辑器。
否则你可以使用这种方式。
猫 > ../../p1/pop.txt
vim ../../p1/pop.txt
.. 表示反向引用或上一个目录。