farmer-logo.gif (14959 bytes) cshell-logo.gif (19625 bytes)
ch-3.gif (10141 bytes)
main-b.gif (271 bytes)

3-8-12 repeat 指令

這個指令相當的特殊(當然也是懶人最常用的用),它的功能是,“重複執行”你所指定的指令。使用的語法如下:

repeat 執行次數 執行指令

讓我們來看一個例子:

% repeat 3 echo "C shell repeat command"
C shell repeat command
C shell repeat command
C shell repeat command
%

如果當你真有需要重複執行某個指令很多次時,這個內建指令可好用的很。這種例子並非沒有,譬如說執行多次才令人安心的指令 sync,便是使用 repeat 的最好時機。


mail.gif (2925 bytes)

b-line.gif (2092 bytes)