るりまサーチ

最速Rubyリファレンスマニュアル検索!
96件ヒット [1-96件を表示] (0.027秒)
トップページ > クエリ:command[x] > クラス:Shell::Filter[x]

別のキーワード

  1. shell/builtin-command new
  2. shell/builtin-command each
  3. rubygems/command command
  4. irb/extend-command def_extend_command
  5. irb/extend-command install_extend_commands

ライブラリ

キーワード

検索結果

Shell::Filter#find_system_command(command) (6203.0)

@todo

@todo

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

command を実行する.

...
command
を実行する.

@param command 実行するコマンドのパスを文字列で指定します。

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

使用例:

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

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

Shell::Filter#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (109.0)

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

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

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...

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

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

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

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...

Shell::Filter#|(filter) -> object (19.0)

パイプ結合を filter に対して行います。

...に対して行います。

@param filter Shell::Filter オブジェクトを指定します。

@return filter を返します。

使用例
require 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {...

絞り込み条件を変える

Shell::Filter#<(src) -> self (7.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 (7.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")...

Shell::Filter#>>(to) -> self (7.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...

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

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

...param files シェルコマンド 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(...

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

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

....

@param strings シェルコマンド 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(fi...

絞り込み条件を変える

Shell::Filter#glob(pattern) -> Shell::Filter (7.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(f...

Shell::Filter#out(dev = STDOUT, &block) -> () (7.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#tee(file) -> Shell::Filter (7.0)

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

...@param file シェルコマンド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(...

Shell::Filter#to_a -> [String] (7.0)

実行結果を文字列の配列で返します。

...実行結果を文字列の配列で返します。

require 'shell'
Shell.def_system_command("wc")
sh = Shell.new
puts sh.cat("/etc/passwd").to_a...

Shell::Filter#to_s -> String (7.0)

実行結果を文字列で返します。

...実行結果を文字列で返します。

require 'shell'
Shell.def_system_command("wc")
sh = Shell.new

sh.transact {
puts (cat("/etc/passwd") | wc("-l")).to_s
}...

絞り込み条件を変える

Shell::Filter#transact { ... } -> object (7.0)

ブロック中で shell を self として実行します。

...ブロック中で shell を self として実行します。

例:

require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact{
system("ls", "-l") | head > STDOUT
# transact の中では、
# sh.system("ls", "-l") | sh.head > STDOUT と同じとなる。
}...