種類
- インスタンスメソッド (132)
- 特異メソッド (36)
ライブラリ
- shell (60)
-
shell
/ command-processor (48) -
shell
/ filter (60)
クラス
- Shell (60)
-
Shell
:: CommandProcessor (48) -
Shell
:: Filter (60)
キーワード
- < (6)
- > (6)
- >> (6)
-
alias
_ command (6) - cat (18)
- echo (18)
- glob (18)
- out (18)
- system (18)
- tee (18)
-
unalias
_ command (6) -
undef
_ system _ command (12) - | (6)
検索結果
先頭5件
- Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () - Shell
. def _ system _ command(command , path = command) -> nil - Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor - Shell
:: CommandProcessor . undef _ system _ command(command) -> self - Shell
. alias _ command(alias , command , *opts) { . . . } -> self
-
Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () (18129.0) -
@todo
...@todo
与えられたコマンドをメソッドとして定義します。
@param command 定義したいコマンドを指定します。
@param path command のパスを指定します。省略すると環境変数 PATH から command を探します。... -
Shell
. def _ system _ command(command , path = command) -> nil (18125.0) -
Shell のメソッドとして command を登録します.
...ります.
@param command Shell のメソッドとして定義するコマンドを文字列で指定します。
@param path command のパスを指定します。
指定しない場合はcommand と同じになります。
例)
require 'shell'
Shell.def_system_command "ls"
# l......s を定義
Shell.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義
sh = Shell.new
sh.transact {
ls.each { |l|
puts l
}
(ls("-l") | sys_sort("-k 5")).each {|l|
puts l
}
}... -
Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor (6112.0) -
commandを削除します.
...commandを削除します.
@param command 削除するコマンドの文字列を指定します。
動作例:
require 'shell'
Shell.def_system_command("ls")
# ls を定義
Shell.undef_system_command("ls")
# ls を 削除
sh = Shell.new
begin
sh.transact {
ls("-l").each... -
Shell
:: CommandProcessor . undef _ system _ command(command) -> self (6106.0) -
与えられたコマンドを削除します。
...与えられたコマンドを削除します。
@param command 削除したいコマンド名を指定します。... -
Shell
. alias _ command(alias , command , *opts) { . . . } -> self (46.0) -
コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.
...します。
コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.
@param alias エイリアスの名前を文字列で指定します.
@param command コマンド名を文字列で指定します.
@param opts command で指定したコマンドのオ......ンを指定します.
使用例: ls -la | sort -k 5 のような例。
require 'shell'
Shell.def_system_command("ls")
Shell.alias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}... -
Shell
:: Filter # |(filter) -> object (30.0) -
パイプ結合を filter に対して行います。
...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.transa... -
Shell
. unalias _ command(alias) -> () (24.0) -
commandのaliasを削除します.
...除します.
@param alias 削除したいエイリアスの名前を文字列で指定します。
@raise NameError alias で指定したコマンドが無い場合に発生します。
使用例: ls -la | sort -k 5 のような例。
require 'shell'
Shell.def_system_command("ls")
Shell.al......ias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}
Shell.unalias_command("lsla")
begin
Shell.unalias_command("lsla")
rescue NameError => err
puts err
end... -
Shell
# glob(pattern) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.tr......ansact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
# out(dev = STDOUT , &block) -> () (18.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@param block transact 内部で実行するシェルを指定します。
使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt... -
Shell
# system(command , *opts) -> Shell :: SystemCommand (18.0) -
command を実行する.
....
@param command 実行するコマンドのパスを文字列で指定します。
@param opts command のオプションを文字列で指定します。複数可。
使用例:
require 'shell'
Shell.verbose = false
sh = Shell.new
print sh.system("ls", "-l")
Shell.def_system_command(... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.tr......ansact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
:: CommandProcessor # out(dev = STDOUT , &block) -> () (18.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@param block transact 内部で実行するシェルを指定します。
使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt... -
Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand (18.0) -
command を実行する.
....
@param command 実行するコマンドのパスを文字列で指定します。
@param opts command のオプションを文字列で指定します。複数可。
使用例:
require 'shell'
Shell.verbose = false
sh = Shell.new
print sh.system("ls", "-l")
Shell.def_system_command(... -
Shell
:: Filter # glob(pattern) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.tr......ansact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
:: Filter # out(dev = STDOUT , &block) -> () (18.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@param block transact 内部で実行するシェルを指定します。
使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt... -
Shell
:: Filter # system(command , *opts) -> Shell :: SystemCommand (18.0) -
command を実行する.
....
@param command 実行するコマンドのパスを文字列で指定します。
@param opts command のオプションを文字列で指定します。複数可。
使用例:
require 'shell'
Shell.verbose = false
sh = Shell.new
print sh.system("ls", "-l")
Shell.def_system_command(... -
Shell
# cat(*files) -> Shell :: Filter (12.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
..., それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each {...