Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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
Shell 如何在终端中使用范围触摸多个文件_Shell_Terminal_Zsh - Fatal编程技术网

Shell 如何在终端中使用范围触摸多个文件

Shell 如何在终端中使用范围触摸多个文件,shell,terminal,zsh,Shell,Terminal,Zsh,我使用zsh。我想触摸0023.rb0024.rb。。。。0040.rb 是否有更好的方式使用终端中的范围来触摸文件 # something like this $touch (0023..0040).rb 您希望,然后通过管道将其输出到: 您可以使用设置数字格式。对于最小4位0填充数字,请使用%04.f: seq -f %04.f 99 101|xargs -Inumber touch number.rb 在zsh下测试: kent$ touch {0010..0015}.foo

我使用zsh。我想触摸0023.rb0024.rb。。。。0040.rb

是否有更好的方式使用终端中的范围来触摸文件

# something like this
$touch (0023..0040).rb 
您希望,然后通过管道将其输出到:

您可以使用设置数字格式。对于最小4位0填充数字,请使用
%04.f

 seq -f %04.f 99 101|xargs -Inumber touch number.rb
在zsh下测试:

kent$  touch {0010..0015}.foo

kent$  l
total 0
-rw-r--r-- 1 kent kent 0 May 15 16:20 0010.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0011.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0012.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0013.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0014.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0015.foo

这是一个关于shell脚本的问题。关闭似乎过于热情。
kent$  touch {0010..0015}.foo

kent$  l
total 0
-rw-r--r-- 1 kent kent 0 May 15 16:20 0010.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0011.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0012.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0013.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0014.foo
-rw-r--r-- 1 kent kent 0 May 15 16:20 0015.foo