るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
59件ヒット [1-59件を表示] (0.026秒)

別のキーワード

  1. kernel system
  2. _builtin system
  3. socket pf_system
  4. socket af_system
  5. socket eai_system

検索結果

Shell#system(command, *opts) -> Shell::SystemCommand (54664.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#system(command, *opts) -> Shell::SystemCommand (54661.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::Filter#system(command, *opts) -> Shell::SystemCommand (54661.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.install_system_commands(pre = "sys_") -> () (18376.0)

system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.

...イルをShellに定義する. メソッ
ド名は元のファイル名の頭にpreをつけたものとなる.

@param pre Shellに定義するメソッド名の先頭に付加される文字列を指定します。

使用例: ls -l | head -n 5 のような例。

require 'shell'
Shell
.install...
..._system_commands
sh = Shell.new
sh.verbose = false
sh.transact {
(sys_ls("-l") | sys_head("-n 5")).each {|l|
puts l
}
}...

Shell.default_system_path -> Array (18367.0)

Shellでもちいられるコマンドを検索する対象のパスを設定および、参照します。

...
Shell
でもちいられるコマンドを検索する対象のパスを設定および、参照します。

@param path Shellでもちいられるコマンドを検索する対象のパスを文字列で指定します。

動作例
require 'shell'
p Shell.default_system_path
# 例
#=> [...
..."/opt/local/bin", "/opt/local/sbin", "/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin", "/usr/X11/bin", "/Users/kouya/bin"]
Shell
.default_system_path = ENV["HOME"] + "/bin"
p Shell.default_system_path
# => "/Users/kouya/bin"...

絞り込み条件を変える

Shell.default_system_path=(path) (18367.0)

Shellでもちいられるコマンドを検索する対象のパスを設定および、参照します。

...
Shell
でもちいられるコマンドを検索する対象のパスを設定および、参照します。

@param path Shellでもちいられるコマンドを検索する対象のパスを文字列で指定します。

動作例
require 'shell'
p Shell.default_system_path
# 例
#=> [...
..."/opt/local/bin", "/opt/local/sbin", "/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin", "/usr/X11/bin", "/Users/kouya/bin"]
Shell
.default_system_path = ENV["HOME"] + "/bin"
p Shell.default_system_path
# => "/Users/kouya/bin"...

Shell.def_system_command(command, path = command) -> nil (18364.0)

Shell のメソッドとして command を登録します.

...
Shell
のメソッドとして command を登録します.

OS上のコマンドを実行するにはまず, Shellのメソッドとして定義します.
注) コマンドを定義しなくとも直接実行できる Shell#system コマンドもあります.

@param command Shell のメソッド...
...ない場合はcommand と同じになります。

例)
require 'shell'
Shell
.def_system_command "ls"
# ls を定義

Shell
.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義

sh = Shell.new
sh.transact {
ls.each { |l|
puts l
}
(ls("-l...

Shell#system_path -> Array (18349.0)

コマンドサーチパスの配列を返す。

...コマンドサーチパスの配列を返す。

@param path コマンドサーチパスの配列を指定します。

使用例

require 'shell'
sh = Shell.new
sh.system_path = [ "./" ]
p sh.system_path #=> ["./"]...

Shell#system_path=(path) (18349.0)

コマンドサーチパスの配列を返す。

...コマンドサーチパスの配列を返す。

@param path コマンドサーチパスの配列を指定します。

使用例

require 'shell'
sh = Shell.new
sh.system_path = [ "./" ]
p sh.system_path #=> ["./"]...

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

commandを削除します.

...mmand 削除するコマンドの文字列を指定します。

動作例:
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
}
}
r...

絞り込み条件を変える

Shell#find_system_command(command) (18310.0)

@todo

@todo

Shell::CommandProcessor#find_system_command(command) (18307.0)

@todo

@todo

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

@todo

@todo

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

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

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

Shell::CommandProcessor.install_system_commands(prefix = "sys_") -> () (18307.0)

全てのシステムコマンドをメソッドとして定義します。

全てのシステムコマンドをメソッドとして定義します。

既に定義されているコマンドを再定義することはありません。
デフォルトでは全てのコマンドに "sys_" というプレフィクスが付きます。
また、メソッド名として使用できない文字は全て "_" に置換してメソッドを定義します。
このメソッドの実行中に発生した例外は単に無視されます。

@param prefix プレフィクスを指定します。

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

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

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

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

絞り込み条件を変える

Shell::Filter#find_system_command(command) (18307.0)

@todo

@todo

Shell::SystemCommand (18004.0)

Shell::SystemCommand#active? -> bool (9004.0)

@todo

@todo

Shell::SystemCommand#command -> String (9004.0)

@todo

@todo

コマンド名を返します。

Shell::SystemCommand#each(rs = nil) {|line| ... } (9004.0)

@todo

@todo

@param rs

絞り込み条件を変える

Shell::SystemCommand#flush -> () (9004.0)

@todo

@todo

Shell::SystemCommand#input=(inp) (9004.0)

@todo

@todo

Shell::SystemCommand#kill(signal) -> Integer (9004.0)

自身のプロセスにシグナルを送ります。

自身のプロセスにシグナルを送ります。

@param signal シグナルを整数かその名前の文字列で指定します。
負の値を持つシグナル(あるいはシグナル名の前に-)を指定すると、
プロセスではなくプロセスグループにシグナルを送ります。

@see Process.#kill

Shell::SystemCommand#name -> String (9004.0)

@todo

@todo

コマンド名を返します。

Shell::SystemCommand#notify(*opts) -> String (9004.0)

@todo

...@todo

@param opts

@see Shell#notify...

絞り込み条件を変える

Shell::SystemCommand#notify(*opts) {|message| ... } -> String (9004.0)

@todo

...@todo

@param opts

@see Shell#notify...

Shell::SystemCommand#start -> () (9004.0)

@todo

@todo

Shell::SystemCommand#start_export (9004.0)

@todo

@todo

Shell::SystemCommand#start_import -> () (9004.0)

@todo

@todo

Shell::SystemCommand#super_each -> () (9004.0)

@todo

...@todo

Shell
::Filter#each です。...

絞り込み条件を変える

Shell::SystemCommand#terminate -> () (9004.0)

@todo

@todo

Shell::SystemCommand#wait? -> bool (9004.0)

@todo

@todo

Shell::SystemCommand.new(sh, command, *opts) (9004.0)

@todo

@todo

@param sh

@param command

@param opts

Shell.alias_command(alias, command, *opts) {...} -> self (91.0)

コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

...コマンドの別名(エイリアス)を作成します。
コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

@param alias エイリアスの名前を文字列で指定します.

@param command コマンド名を文字列で指定します.

@param...
...を指定します.

使用例: 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#transact { ... } -> object (61.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#transact { ... } -> object (58.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::Filter#transact { ... } -> object (58.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::Filter#|(filter) -> object (58.0)

パイプ結合を 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.transact {
i = 1...

Shell#out(dev = STDOUT, &block) -> () (43.0)

Shell#transact を呼び出しその結果を dev に出力します。

...
Shell
#transact を呼び出しその結果を dev に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell
.def_system_command("head")
sh = Shell...

Shell.unalias_command(alias) -> () (43.0)

commandのaliasを削除します.

...例。
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
.unalias_command("lsla")
begin
Shell
.unalias_command("...

絞り込み条件を変える

Shell::CommandProcessor#out(dev = STDOUT, &block) -> () (40.0)

Shell#transact を呼び出しその結果を dev に出力します。

...
Shell
#transact を呼び出しその結果を dev に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell
.def_system_command("head")
sh = Shell...

Shell::Filter#out(dev = STDOUT, &block) -> () (40.0)

Shell#transact を呼び出しその結果を dev に出力します。

...
Shell
#transact を呼び出しその結果を dev に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell
.def_system_command("head")
sh = Shell...

Shell#cat(*files) -> Shell::Filter (25.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) | te...

Shell#echo(*strings) -> Shell::Filter (25.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#glob(pattern) -> Shell::Filter (25.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#tee(file) -> Shell::Filter (25.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...

Shell::CommandProcessor#cat(*files) -> Shell::Filter (22.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) | te...

Shell::CommandProcessor#echo(*strings) -> Shell::Filter (22.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 (22.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 (22.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...

絞り込み条件を変える

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

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

...ばそれをそのまま入力とする。

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

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

Shell::Filter#>(to) -> self (22.0)

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

...ます。文字列ならばファイルに,IOオブジェクトならばそれに出力します。

使用例
require 'shell'
Shell
.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd...

Shell::Filter#>>(to) -> self (22.0)

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

...す。文字列ならばファイルに、IOオブジェクトならばそれに出力します。

使用例
require 'shell'
Shell
.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open...

Shell::Filter#cat(*files) -> Shell::Filter (22.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) | te...

Shell::Filter#echo(*strings) -> Shell::Filter (22.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::Filter#glob(pattern) -> Shell::Filter (22.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::Filter#tee(file) -> Shell::Filter (22.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...

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

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

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

require 'shell'
Shell
.def_system_command("wc")
sh = Shell.new
puts sh.cat("/etc/passwd").to_a...

Shell::Filter#to_s -> String (22.0)

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

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

require 'shell'
Shell
.def_system_command("wc")
sh = Shell.new

sh.transact {
puts (cat("/etc/passwd") | wc("-l")).to_s
}...