Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 在(子)目录中创建多个文件_Bash_File_Terminal_Touch_Brace Expansion - Fatal编程技术网

Bash 在(子)目录中创建多个文件

Bash 在(子)目录中创建多个文件,bash,file,terminal,touch,brace-expansion,Bash,File,Terminal,Touch,Brace Expansion,如何在终端中使用一个命令在同一目录/子目录中创建多个文件 我知道这是有可能的 touch ./path/to/the/directory/file1.txt ./path/to/the/directory/file2.txt 但我想看看是否可以跳过输入每个文件的完整路径 我原以为touch./path/to/the/directory/{file1.txt file2.txt}可以奏效,但似乎不行。touch./path/to/the/directory/{file1.txt,file2.t

如何在终端中使用一个命令在同一目录/子目录中创建多个文件

我知道这是有可能的

touch ./path/to/the/directory/file1.txt  ./path/to/the/directory/file2.txt
但我想看看是否可以跳过输入每个文件的完整路径


我原以为
touch./path/to/the/directory/{file1.txt file2.txt}
可以奏效,但似乎不行。

touch./path/to/the/directory/{file1.txt,file2.txt}
或者有一个范围:
touch./path/to/the/directory/file{1..5}.txt
,当然,那是个愚蠢的逗号!谢谢:)@Itdev:别忘了,
touch
不仅会创建文件,如果它不存在,还会更改它的时间戳(如果它已经存在)。取决于你想要实现什么,这可能是你想要的,也可能不是。