#navi(../)
* ファイルのパーミッション変更方法 [#w4e68ccd]
FileUtils.chmodを利用するとファイルのパーミッションを変更することができます。~
''require "fileutils"''が必要になります。
#contents
//#htmlinsert(ll_ads_top.html)
* パーミッション変更のサンプルソース [#q140b538]
#ref(file_chmod.rb)
require "fileutils"
f = File.open("hello.sh", "w")
f.puts("#!/bin/bash")
f.puts("echo Hello world!")
f.close
FileUtils.chmod(0755, "hello.sh")
** 実行結果 [#f4c69b09]
$ ruby file_chmod.rb
$ ls -l hello.sh
-rwxr-xr-x 1 sakura staff 30 2 11 21:42 hello.sh
$ ./hello.sh
Hello world!
//#htmlinsert(ll_ads_btm.html)