Re: [問題] 1-9位數不重複印出來(bash)

看板Programming作者 (轉角遇到愛)時間7年前 (2016/11/23 15:22), 7年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
※ 引述《mikemagic88 (Mikemagic88)》之銘言: : 使用者輸入1 印1-9 : 使用者輸入2 印1-98 (11, 22, 33等重複的不印) : 使用者輸入3 印1-987 (121, 988, 667等有重複的不印) 嗯…強者Rickz花了10秒寫的 #!/bin/bash read -p 'Enter a number: ' num seq $((10**${num}-1)) \ | egrep -v "1.*1|2.*2|3.*3|4.*4|5.*5|6.*6|7.*7|8.*8|9.*9|0.*0" \ | sed ':x;N;$!bx;s/\n/, /g' -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.134.48.253 ※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1479885754.A.DFE.html ※ 編輯: shadowjohn (140.134.48.253), 11/23/2016 15:24:40 ※ 編輯: shadowjohn (140.134.48.253), 11/23/2016 15:32:11 ※ 編輯: shadowjohn (140.134.48.253), 11/23/2016 15:33:18 ※ 編輯: shadowjohn (140.134.48.253), 11/23/2016 15:46:16
文章代碼(AID): #1ODKEwt- (Programming)