tmpCounts[1]='a' elsif (/^\w/).match(articles).to_s.upcase == 'B' tmpCounts[1]='b' elsif (/^\w/).match(articles).to_s.upcase == 'C' tmpCounts[1]='c' else tmpCounts[1]='d' end |
是elsif
反正就是一整個好玩!!!(  ̄ c ̄)y▂ξ
tmpCounts[1]='a' elsif (/^\w/).match(articles).to_s.upcase == 'B' tmpCounts[1]='b' elsif (/^\w/).match(articles).to_s.upcase == 'C' tmpCounts[1]='c' else tmpCounts[1]='d' end |
是elsif
兩陣列比較,列出不同者
a=[1,2,3]
|
批次更改副檔名, 例如, *.txt 改成 *.doc
#!/usr/bin/ruby -Ku Dir.glob('./*.txt').each do |file| system("mv #{file} #{file.gsub(/\.txt$/, '.doc')}") end |
ruby語言,實在很吸引人,可以像人說話一樣表示,並做到批次處理功能
所需指令 useradd, smbpasswd, 可一次大量建立系統及samba帳號密碼