るりまサーチ

最速Rubyリファレンスマニュアル検索!
2503件ヒット [101-200件を表示] (0.022秒)
トップページ > クエリ:sh[x] > クエリ:Shell[x]

別のキーワード

  1. rake sh
  2. fileutils sh
  3. constants lock_sh
  4. _builtin lock_sh
  5. sync sh

モジュール

キーワード

検索結果

<< < 1 2 3 4 ... > >>

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

commandを削除します.

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

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

Shell#cat(*files) -> Shell::Filter (24231.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...ram 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(fi...

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

Shell#tee(file) -> Shell::Filter (24231.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(fi...

絞り込み条件を変える

Shell.new(pwd = Dir.pwd, umask = nil) -> Shell (24217.0)

プロセスのカレントディレクトリをpwd で指定されたディレクトリとするShellオ ブジェクトを生成します.

...プロセスのカレントディレクトリをpwd で指定されたディレクトリとするShell
ブジェクトを生成します.

@param pwd プロセスのカレントディレクトリをpwd で指定されたディレクトリとします。
指定しない場合は、Dir....

Shell#command_processor -> Shell::CommandProcessor (24201.0)

@todo

@todo

Shell#concat(*jobs) -> Shell::Concat (24201.0)

@todo

@todo

Shell#process_controller -> Shell::ProcessController (24201.0)

@todo

@todo

Shell.def_system_command(command, path = command) -> nil (24070.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") | s...

絞り込み条件を変える

Shell#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (24060.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...定します。

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", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true...

Shell#popd -> () (24060.0)

ディレクトリスタックからポップし, それをカレントディレクトリにする.

...ディレクトリスタックからポップし, それをカレントディレクトリにする.

動作例
require 'shell'
Shell
.verbose = false
sh
= Shell.new
sh
.pushd("/tmp")
p sh.cwd #=> "/tmp"
sh
.pushd("/usr")
p sh.cwd #=> "/usr"
sh
.popd
p sh.cwd #=> "/tmp"...

Shell#popdir -> () (24060.0)

ディレクトリスタックからポップし, それをカレントディレクトリにする.

...ディレクトリスタックからポップし, それをカレントディレクトリにする.

動作例
require 'shell'
Shell
.verbose = false
sh
= Shell.new
sh
.pushd("/tmp")
p sh.cwd #=> "/tmp"
sh
.pushd("/usr")
p sh.cwd #=> "/usr"
sh
.popd
p sh.cwd #=> "/tmp"...

Shell#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (24060.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...定します。

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", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true...

Shell#transact { ... } -> object (24058.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.alias_command(alias, command, *opts) {...} -> self (24058.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.install_system_commands(pre = "sys_") -> () (24058.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.unalias_command(alias) -> () (24054.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("...
<< < 1 2 3 4 ... > >>