るりまサーチ

最速Rubyリファレンスマニュアル検索!
126件ヒット [1-100件を表示] (0.024秒)
トップページ > クエリ:new[x] > ライブラリ:shell/filter[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

クラス

キーワード

検索結果

<< 1 2 > >>

Shell::Filter.new(sh) -> Shell::Filter (18103.0)

Shell::Filter クラスのインスタンスを返します。 通常このメソッドを直接使う機会は少ないでしょう。

Shell::Filter クラスのインスタンスを返します。
通常このメソッドを直接使う機会は少ないでしょう。

Shell::Filter#link(old, new) -> 0 (109.0)

File クラスにある同名のクラスメソッドと同じです.

...File クラスにある同名のクラスメソッドと同じです.

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

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

@see File.link...

Shell::Filter#symlink(old, new) -> 0 (109.0)

File クラスにある同名のクラスメソッドと同じです.

...File クラスにある同名のクラスメソッドと同じです.

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

@param new シンボリックリンクを表す文字列を指定します。

@see File.symlink...

Shell::Filter#<(src) -> self (8.0)

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

...ばそれをそのまま入力とする。

@param src フィルタの入力を, 文字列もしくは,IO オブジェクトで指定します。

使用例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
(sh.head("-n 30") < "/etc/passwd") > "ugo.txt"
}...

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") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd") > "tail.out" # と同じ....

絞り込み条件を変える

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#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (8.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => tru...

Shell::Filter#cat(*files) -> Shell::Filter (8.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"...

Shell::Filter#each(rs = nil) -> () (8.0)

フィルタの一行ずつをblockに渡します。

...行ずつをblockに渡します。

@param rs レコードセパレーターを表す文字列を指定します。
nil ならば、Shell.record_separatorの値が使用されます。

使用例
require 'shell'
sh = Shell.new
sh.cat("/etc/passwd").each { |line|
puts line
}...

Shell::Filter#echo(*strings) -> Shell::Filter (8.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...コマンド echo に与える引数を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"...

絞り込み条件を変える

Shell::Filter#foreach(path = nil, &block) -> () (8.0)

pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach の動作をします。

...なら, File#foreach
pathがディレクトリなら, Dir#foreach
の動作をします。

@param path ファイルもしくはディレクトリのパスを文字列で指定します。

使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.foreach("/tmp"){|f|
puts f
}...

Shell::Filter#glob(pattern) -> Shell::Filter (8.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ーンの書式については、Dir.[] を参照してください。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"...

Shell::Filter#mkdir(*path) -> Array (8.0)

Dir.mkdirと同じです。 (複数可)

...ram path 作成するディレクトリ名を文字列で指定します。

@return 作成するディレクトリの一覧の配列を返します。

使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end...

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

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

...ェクトなどで指定します。

@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")
}
}...

Shell::Filter#system(command, *opts) -> Shell::SystemCommand (8.0)

command を実行する.

...で指定します。

@param opts command のオプションを文字列で指定します。複数可。

使用例:

require 'shell'
Shell.verbose = false
sh = Shell.new

print sh.system("ls", "-l")
Shell.def_system_command("head")
sh.system("ls", "-l") | sh.head("-n 3") > STDOUT...

絞り込み条件を変える

Shell::Filter#tee(file) -> Shell::Filter (8.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"...

Shell::Filter#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (8.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...指定します。

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => tru...
<< 1 2 > >>