使用 tcsh 终端创建多个空文件

Create multiple empty files using tcsh terminal

我想使用 tcsh 创建多个空文件,类似于命令:

touch {0..999}.txt

未安装 bash。

%echo $SHELL

%/bin/tcsh

如果可能,不使用脚本而是使用终端命令

我刚刚创建了一个简单的脚本来执行此操作:

文件名:script

\#!/bin/tcsh

set j = 1
while ($j <= 10000)
     touch $j.txt
     @ j++ 
end

将脚本的权限更改为 +x :

chmod +x script

并执行:

./script

您可以使用 seq 的格式化选项并通过将多个参数传递给 touch 来避免循环:

touch `seq -f %.0f.txt 1 999`