60件ヒット
[1-60件を表示]
(0.144秒)
種類
- インスタンスメソッド (42)
- 特異メソッド (18)
ライブラリ
キーワード
- cat (6)
-
def
_ system _ command (6) - echo (6)
- glob (6)
-
install
_ system _ commands (6) - out (6)
- tee (6)
- transact (6)
-
undef
_ system _ command (6)
検索結果
先頭5件
- Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand - Shell
:: CommandProcessor . install _ system _ commands(prefix = "sys _ ") -> () - Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () - Shell
:: CommandProcessor . undef _ system _ command(command) -> self - Shell
:: CommandProcessor # transact { . . . } -> object
-
Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand (21320.0) -
command を実行する.
....
@param 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
:: CommandProcessor . install _ system _ commands(prefix = "sys _ ") -> () (9302.0) -
全てのシステムコマンドをメソッドとして定義します。
...うプレフィクスが付きます。
また、メソッド名として使用できない文字は全て "_" に置換してメソッドを定義します。
このメソッドの実行中に発生した例外は単に無視されます。
@param prefix プレフィクスを指定します。... -
Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () (9202.0) -
@todo
...@todo
与えられたコマンドをメソッドとして定義します。
@param command 定義したいコマンドを指定します。
@param path command のパスを指定します。省略すると環境変数 PATH から command を探します。... -
Shell
:: CommandProcessor . undef _ system _ command(command) -> self (9202.0) -
与えられたコマンドを削除します。
...与えられたコマンドを削除します。
@param command 削除したいコマンド名を指定します。... -
Shell
:: CommandProcessor # transact { . . . } -> object (6219.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 と同じとなる。
}... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (3207.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
..., それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {... -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (3207.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...と, それらを内容とする Filter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |fi... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (3207.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、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"
}
}
}
@see Dir.[]... -
Shell
:: CommandProcessor # tee(file) -> Shell :: Filter (3207.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...と, それらを内容とする Filter オブジェクトを返します.
@param file シェルコマンドtee に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {... -
Shell
:: CommandProcessor # out(dev = STDOUT , &block) -> () (3113.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")
}
}...