2011-11-30 25 views
0

我有一個測試(這基本上是一個可執行的),我想那裏跑幾次。就是像某種腳本或什麼的來做到這一點?基本上,我想運行循環運行的可執行

terminal>./test and do this like n times. 

這是用於命令行。

P.S我沒有名字的可執行測試..我只是使用了mneumonic幫助我在說什麼

回答

1

如何

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 
+0

是'in'後的一個流浪'1'? –

+0

@ShawnChin謝謝! – cnicutar

2

不要叫test程序。

您可以使用重複 zsh的內置(例如,

repeat 12 ./test 
+0

它說重複:找不到的命令 – Manish

+0

是的,這是一個zsh內建,而不是一個bash之一....這是我更喜歡zsh作爲一個交互式shell的許多原因之一... –