Re: [問題] script 印出一百個*

看板LinuxDev作者 (呈呈)時間17年前 (2008/05/01 00:37), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/4 (看更多)
※ 引述《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
文章代碼(AID): #186A1EMv (LinuxDev)
討論串 (同標題文章)
文章代碼(AID): #186A1EMv (LinuxDev)