別のキーワード
種類
- インスタンスメソッド (78)
- 特異メソッド (18)
クラス
- Shell (6)
-
Shell
:: CommandProcessor (84) -
Shell
:: ProcessController (6)
検索結果
先頭5件
-
Shell
:: CommandProcessor . new(shell) (21102.0) -
@todo
@todo -
Shell
:: ProcessController . new(shell) (21102.0) -
自身を初期化します。
...自身を初期化します。
@param shell Shell のインスタンスを指定します。... -
Shell
:: CommandProcessor # link(old , new) -> 0 (3108.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new ファイル名を表す文字列を指定します。
@see File.link... -
Shell
:: CommandProcessor # symlink(old , new) -> 0 (3108.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new シンボリックリンクを表す文字列を指定します。
@see File.symlink... -
Shell
:: CommandProcessor # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (3007.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"... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (3007.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
:: CommandProcessor # echo(*strings) -> Shell :: Filter (3007.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
:: CommandProcessor # foreach(path = nil , &block) -> () (3007.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
:: CommandProcessor # glob(pattern) -> Shell :: Filter (3007.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
:: CommandProcessor # mkdir(*path) -> Array (3007.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
:: CommandProcessor # out(dev = STDOUT , &block) -> () (3007.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")
}
}... -
Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand (3007.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
:: CommandProcessor # tee(file) -> Shell :: Filter (3007.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
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (3007.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"... -
Shell
:: CommandProcessor # transact { . . . } -> object (3007.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
. undef _ system _ command(command) -> Shell :: CommandProcessor (108.0) -
commandを削除します.
...and 削除するコマンドの文字列を指定します。
動作例:
require '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
}
}
res...