るりまサーチ

最速Rubyリファレンスマニュアル検索!
168件ヒット [1-100件を表示] (0.429秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:def_system_command[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Shell::CommandProcessor.def_system_command(command, path = command) -> () (21201.0)

@todo

...@todo

与えられたコマンドをメソッドとして定義します。

@param command 定義したいコマンドを指定します。

@param path command のパスを指定します。省略すると環境変数 PATH から command を探します。...

Shell::CommandProcessor.undef_system_command(command) -> self (9200.0)

与えられたコマンドを削除します。

...与えられたコマンドを削除します。

@param command 削除したいコマンド名を指定します。...

Shell.undef_system_command(command) -> Shell::CommandProcessor (6306.0)

commandを削除します.

...除します.

@param command 削除するコマンドの文字列を指定します。

動作例:
r
equire 'shell'
Shell.def_system_command("ls")
# ls を定義
Shell.undef_system_command("ls")
# ls を 削除

sh = Shell.new
begin
sh.transact {
ls("-l").each {|l|...
...puts l
}
}
r
escue NameError => err
puts err
end...

Shell#transact { ... } -> object (6206.0)

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

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

例:

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

Shell::CommandProcessor#transact { ... } -> object (6206.0)

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

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

例:

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

絞り込み条件を変える

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

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

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

例:

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

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

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

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

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

@return filter を返します。

使用例
r
equire 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transac...
...t {
i = 1
while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}...

Shell::CommandProcessor#cat(*files) -> Shell::Filter (3206.0)

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

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

@param files シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {...

Shell::CommandProcessor#echo(*strings) -> Shell::Filter (3206.0)

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

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

@param strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |fi...

Shell::CommandProcessor#glob(pattern) -> Shell::Filter (3206.0)

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

...する Filter オブジェクトを返します.

@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。

動作例
r
equire '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"
}
}
}

@see Dir.[]...

絞り込み条件を変える

Shell::CommandProcessor#tee(file) -> Shell::Filter (3206.0)

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

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

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {...

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

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

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

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

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

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

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

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

@param files シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {...

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

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

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

@param strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |fi...

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

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

...する Filter オブジェクトを返します.

@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。

動作例
r
equire '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"
}
}
}

@see Dir.[]...

絞り込み条件を変える

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

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

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

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
r
equire 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {...

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

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

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

r
equire 'shell'
Shell.def_system_command("wc")
sh = Shell.new
puts sh.cat("/etc/passwd").to_a...
<< 1 2 > >>