るりまサーチ

最速Rubyリファレンスマニュアル検索!
1008件ヒット [1001-1008件を表示] (0.023秒)

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. base file
  4. file open
  5. file path

キーワード

検索結果

<< < ... 9 10 11 >>

Shell::Filter#>>(to) -> self (8.0)

toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。

...IOオブジェクトならばそれに出力します。

使用例
require 'shell'
Shell
.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}...

Shell::Filter#out(dev = STDOUT, &block) -> () (8.0)

Shell#transact を呼び出しその結果を dev に出力します。

...
Shell
#transact を呼び出しその結果を dev に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell
.def_system_command("head")
sh = Shell...
....new
File
.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...
<< < ... 9 10 11 >>