別のキーワード
種類
- インスタンスメソッド (48)
- 特異メソッド (24)
- 文書 (22)
ライブラリ
- shell (6)
-
shell
/ command-processor (66)
クラス
- Shell (6)
-
Shell
:: CommandProcessor (66)
キーワード
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- cat (6)
-
def
_ system _ command (6) - echo (6)
-
find
_ system _ command (6) - glob (6)
-
install
_ system _ commands (6) - out (6)
-
ruby 1
. 9 feature (11) - tee (6)
- transact (6)
-
undef
_ system _ command (12)
検索結果
先頭5件
- Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand - Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () - Shell
:: CommandProcessor . undef _ system _ command(command) -> self - Shell
:: CommandProcessor # find _ system _ command(command) - Shell
:: CommandProcessor . install _ system _ commands(prefix = "sys _ ") -> ()
-
Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand (24454.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
:: CommandProcessor . def _ system _ command(command , path = command) -> () (18422.0) -
@todo
...@todo
与えられたコマンドをメソッドとして定義します。
@param command 定義したいコマンドを指定します。
@param path command のパスを指定します。省略すると環境変数 PATH から command を探します。... -
Shell
:: CommandProcessor . undef _ system _ command(command) -> self (18309.0) -
与えられたコマンドを削除します。
...与えられたコマンドを削除します。
@param command 削除したいコマンド名を指定します。... -
Shell
:: CommandProcessor # find _ system _ command(command) (18303.0) -
@todo
@todo -
Shell
:: CommandProcessor . install _ system _ commands(prefix = "sys _ ") -> () (18201.0) -
全てのシステムコマンドをメソッドとして定義します。
全てのシステムコマンドをメソッドとして定義します。
既に定義されているコマンドを再定義することはありません。
デフォルトでは全てのコマンドに "sys_" というプレフィクスが付きます。
また、メソッド名として使用できない文字は全て "_" に置換してメソッドを定義します。
このメソッドの実行中に発生した例外は単に無視されます。
@param prefix プレフィクスを指定します。 -
Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor (12549.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 # transact { . . . } -> object (6024.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 # out(dev = STDOUT , &block) -> () (6018.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
:: CommandProcessor # cat(*files) -> Shell :: Filter (6012.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) | t... -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (6012.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... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (6012.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) | te... -
Shell
:: CommandProcessor # tee(file) -> Shell :: Filter (6012.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) | te... -
ruby 1
. 9 feature (114.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...除
=== 2006-06-11
: __callee__ [new]
: __method__ [new]
((<URL:http://www.dm4lab.to/~usa/ruby/d/200606a.html#id20060610_P1_7>))
: Symbol#to_proc
=== 2006-06-10
* 新機能
: BasicObject が導入されました [new]
: local という visibility および Module#local, Module#local_meth......組み込み関数/system>)) 等と同様、第一引数に配列でコマンドを指定し
た場合にシェルを経由せずに子プロセスを実行できるようになりました。
((<ruby-dev:22877>))
: ((<組み込み関数/spawn>)) [new]
: ((<Process/Process.spawn>)) [ne......-:1:in `system': Permission denied - /tmp (Errno::EACCES)
from -:1
シェルを経由する場合は、これまでどおりです。
p system("hogehoge ''")
# => ruby 1.9.0 (2004-07-17) [i586-linux]
sh: line 1: hogehoge: command not found... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (30.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...> "nomad"
//}
: % ruby -e "puts 'Hello'"
コマンドラインへの入力を示す。rubyスクリプト上で入力を行うには `command` や system(command) などと書く
===[a:and] &
: xxx & yyy
論理積演算子。または類似の演算を行うメソッド。
//emlist{
p( 3......を返す。
//}
: def xxx(&yyy) ・・ &がついた引数
メソッド定義のブロック引数。d:spec/def#methodを参照。
: xxx(&b)
Proc オブジェクトをブロックとして使う。d:spec/call#block を参照。
: xxx&.yyy
safe navigation operator(通称「ぼっち演算......(`)で囲まれた文字列は、コマンドとして実行され、
その標準出力が文字列として与えられます。d:spec/literal#commandを参照。
//emlist{
puts `ruby -h`
#=> Usage: ruby [switches] [--] [programfile] [arguments]
#=> ....
//}
===[a:backslash] \
バッ...