るりまサーチ

最速Rubyリファレンスマニュアル検索!
117件ヒット [1-100件を表示] (0.033秒)
トップページ > クエリ:file[x] > クエリ:chmod[x] > 種類:モジュール関数[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file chown
  4. file ctime

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 > >>

FileUtils.#chmod(mode, list, options = {}) -> Array (21138.0)

ファイル list のパーミッションを mode に変更します。

...c:FileUtils#options

@return list を配列として返します。

//emlist[][ruby]{
# Absolute mode
require 'fileutils'
File
Utils.chmod(0644, %w(my.rb your.rb his.rb her.rb))
File
Utils.chmod(0755, 'somecommand')
File
Utils.chmod(0755, '/usr/bin/ruby', verbose: true)
# Symbolic mode
require 'fileut...
...ils'
File
Utils.chmod("u=wr,go=rr", %w(my.rb your.rb his.rb her.rb))
File
Utils.chmod("u=wrx,go=rx", 'somecommand')
File
Utils.chmod("u=wrx,go=rx", '/usr/bin/ruby', verbose: true)
//}

symbolic mode では以下の指定を 操作対象 演算子 権限 の順番で指定します。

操作対象(複...

FileUtils.#chmod_R(mode, list, options = {}) -> Array (9114.0)

ファイル list のパーミッションを再帰的に mode へ変更します。

...de へ変更します。

@param mode パーミッションを8進数(absolute mode)か文字列(symbolic
mode)で指定します(FileUtils.#chmod 参照)。

@param list ファイルのリストを指定します。対象のファイルが一つの場合は文字列でも指定可能で...
...二つ以上指定する場合は配列で指定します。

@param options :noop と :verbose が指定可能です。
c:FileUtils#options

@return list を配列として返します。

//emlist[][ruby]{
require 'fileutils'
File
Utils.chmod_R(0700, '/tmp/removing')
//}...

FileTest.#sticky?(file) -> bool (3136.0)

ファイルの sticky ビット(chmod(2) 参照)が 立っている時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...ファイルの sticky ビット(chmod(2) 参照)が
立っている時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

@param file ファイル名を表す文字列か...
...IO オブジェクトを指定します。

//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
File
Utils.chmod("o+t", "testfile")
File
Test.sticky?("testfile") # => true
File
Utils.chmod("o-t", "testfile")
File
Test.sticky?("testfile") # => false
//}...

FileTest.#executable_real?(file) -> bool (3132.0)

ファイルがカレントプロセスの実ユーザか実グループで実行できる時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...は false を返します。

@param file ファイル名を表す文字列を指定します。

//emlist[例][ruby]{
IO.write("empty.txt", "")
File
.chmod(0744, "empty.txt")
File
Test.executable_real?("empty.txt") # => true
File
.chmod(0644, "empty.txt")
File
Test.executable_real?("empty.txt")...

FileTest.#readable?(file) -> bool (3132.0)

ファイルがカレントプロセスにより読み込み可能な時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...は false を返します。

@param file ファイル名を表す文字列を指定します。

//emlist[例][ruby]{
IO.write("testfile", "")
File
.chmod(0644, "testfile")
File
Test.readable?("testfile") # => true
File
.chmod(0200, "testfile")
File
Test.readable?("testfile") # => false
//}...

絞り込み条件を変える

FileTest.#writable?(file) -> bool (3132.0)

ファイルがカレントプロセスにより書き込み可能である時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...false を返します。

@param file ファイル名を表す文字列を指定します。

//emlist[例][ruby]{
IO.write("testfile", "test")
File
.chmod(0600, "testfile")
File
Test.writable?("testfile") # => true
File
.chmod(0400, "testfile")
File
Test.writable?("testfile") # => false
//}...

FileTest.#setuid?(file) -> bool (3126.0)

ファイルが setuid(2) されている時に真を返 します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
File
Utils.chmod("u+s",...
..."testfile")
File
Test.setuid?("testfile") # => true
File
Utils.chmod("u-s", "testfile")
File
Test.setuid?("testfile") # => false
//}...

FileTest.#setgid?(file) -> bool (3120.0)

ファイルが setgid(2) されている時に真を返 します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...aram file ファイル名を表す文字列か IO オブジェクトを指定します。

//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
File
Utils.chmod("g+s", "testfile")
File
Test.setgid?("testfile") # => true
File
Utils.chmod("g-s", "testfile")
File
Test.setgid?("testfile")...

Timeout.#timeout(sec, exception_class = nil) {|i| ... } -> object (19.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...るなどの工夫が必要です。

例 外部コマンドのタイムアウト
require 'timeout'

# テスト用のシェルをつくる。
File
.open("loop.sh", "w"){|fp|
fp.print <<SHELL_EOT
#!/bin/bash

S="scale=10"
M=32767

trap 'echo "$S; $m1/($m1+$m2)*4" | bc ; echo "count...
..."$S;$x^2+$y^2 < 1.0" | bc)
echo $x $y $c
if [ $c -eq 1 ]
then
let m1++
else
let m2++
fi
done
SHELL_EOT
}

File
.chmod(0755, "loop.sh")
t = 10 # 10 秒でタイムアウト
begin
pid = nil
com = nil
Timeout.timeout(t) {
# system だとと...
<< 1 2 > >>