2007/11/09

開帳號的ruby

強哥傳授的...筆記!! 筆記!!

用處:以slist裡的string命名開目錄, 並設置user/group

#!/usr/bin/ruby //告知執行檔路徑, 便可打./filename.rb 執行,否則打ruby filename.rb
slist = %w(
95971003
........
)

slist.each do |i|
print "cp -r s93306091/ s" + i + "\n"
print "chown -R s" + i + ":ca s" + i + "\n"
end


使用:
./filename.ruby >> build.sh
(or ruby filename.rb >> build.sh)
sh build.sh           //執行shell script


 

No comments:

Post a Comment