看板 LinuxDev 關於我們 聯絡資訊
※ 引述《RiverJackson (JACK)》之銘言: : 請問一下 : for $a in a b c;then : echo $a : done : 語法應該類似這樣 如果我想印出一到一千呢 : for $b in 1:1:100;then : echo $a : done : 這樣寫應該是錯誤的 要怎麼寫呢~~~~ 排一下版 ==start== declare -i i=1 while let "$i <= 1000" ; do echo $i let i=$i+1; done; ==end== 附上 bash man page 節錄 declare [-afFirtx] [-p] [name[=value] ...] -i The variable is treated as an integer; arithmetic evalua- tion (see ARITHMETIC EVALUATION ) is performed when the variable is assigned a value. let arg [arg ...] Each arg is an arithmetic expression to be evaluated (see ARITH- METIC EVALUATION). If the last arg evaluates to 0, let returns 1; 0 is returned otherwise. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.160.32.211