看板 Linux 關於我們 聯絡資訊
小弟最近初學遇到一題不知道怎解 題目是這樣的 Student wants to display 1 to 1000 numbers with an expansion of 2.Meaning the output should be:1 3 5 7 9 11...Student dont know to write a script. Please help him with a single command to display this. Repeat the same to display all alphabets with expansion of 4 so as to display A E I M … 請大家指導一下 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 50.176.80.252 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1443412574.A.A87.html
kenduest: man seq 09/28 12:51
nullspace: bash -c "echo {1..1000..2}" 09/28 14:17
nullspace: bash -c "echo {A..Z..4}" 09/28 14:17
kenduest: bash 沒有 {1..100..2} 這類語法吧,ksh 才支援 09/28 16:33
kenduest: 不過剛剛看了一下,bash 4.x 有支援沒錯 09/28 16:41
kenduest: 我被手上跑的 bash 3.x linux server 騙了:~ 09/28 16:41
kerwinhui: 還在用bash3不怕shellshock? 09/28 16:47
kerwinhui: 不過的確bash4加了很多features 09/28 16:49
danny8376: centos5的bash還是bash3.2啊 不過有打過patch了XD 09/28 17:03