我有一个测试(这基本上是一个可执行的),我想那里跑几次。就是像某种脚本或什么的来做到这一点?基本上,我想运行循环运行的可执行
terminal>./test and do this like n times.
这是用于命令行。
P.S我没有名字的可执行测试..我只是使用了mneumonic帮助我在说什么
我有一个测试(这基本上是一个可执行的),我想那里跑几次。就是像某种脚本或什么的来做到这一点?基本上,我想运行循环运行的可执行
terminal>./test and do this like n times.
这是用于命令行。
P.S我没有名字的可执行测试..我只是使用了mneumonic帮助我在说什么
如何
for i in `seq 1 $n`; do ./test ; done
这应该对所有的SH-炮弹一样工作。作为一个侧面说明,命名可执行的“测试”是不是最好的主意:
# there's a shell builtin
[[email protected] ~]$ type test
test is a shell builtin
# and a separate executable, for good measure
[[email protected] ~]$ which test
/usr/bin/test
不要叫test
程序。
您可以使用重复 zsh的内置(例如,
repeat 12 ./test
它说重复:找不到的命令 – Manish
是的,这是一个zsh内建,而不是一个bash之一....这是我更喜欢zsh作为一个交互式shell的许多原因之一... –
是'in'后的一个流浪'1'? –
@ShawnChin谢谢! – cnicutar