るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
25件ヒット [1-25件を表示] (0.081秒)
トップページ > 種類:特異メソッド[x] > バージョン:2.5.0[x] > クラス:Shell[x]

検索結果

Shell.alias_command(alias, command, *opts) {...} -> self (7.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.cascade -> bool (7.0)

@todo

@todo

Shell.cascade=(flag) (7.0)

@todo

@todo

Shell.cd(path = nil, verbose = self.verbose) -> self (7.0)

pathをカレントディレクトリとするShellオブジェクトを生成します.

...クトリとするShellオブジェクトを生成します.

@param path カレントディレクトリとするディレクトリを文字列で指定します。

@param verbose true を指定すると冗長な出力を行います。


使用例
require 'shell'
sh = Shell.new
sh.cd("/tmp")...

Shell.debug -> bool | Integer (7.0)

@todo

@todo

デバッグ用フラグを参照します。

絞り込み条件を変える

Shell.debug=(val) (7.0)

デバッグ用のフラグを設定します。

デバッグ用のフラグを設定します。

@param val bool 値や整数値を指定します。詳細は下記を参照してください。

# debug: true -> normal debug
# debug: 1 -> eval definition debug
# debug: 2 -> detail inspect debug

Shell.debug? -> bool | Integer (7.0)

@todo

@todo

デバッグ用フラグを参照します。

Shell.debug_output_lock -> Mutex (7.0)

@todo

@todo

@see Thread::Mutex#lock

Shell.debug_output_locked? -> bool (7.0)

@todo

@todo

@see Thread::Mutex#locked?

Shell.debug_output_synchronize (7.0)

@todo

@todo

@see Thread::Mutex#synchronize

絞り込み条件を変える

Shell.debug_output_try_lock -> bool (7.0)

@todo

@todo

@see Thread::Mutex#try_lock

Shell.debug_output_unlock -> Mutex | nil (7.0)

@todo

@todo

@see Thread::Mutex#unlock

Shell.def_system_command(command, path = command) -> nil (7.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.default_record_separator -> String (7.0)

執筆者募集

...執筆者募集

Shell
で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。

@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定しま...

Shell.default_record_separator=(rs) (7.0)

執筆者募集

...執筆者募集

Shell
で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。

@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定しま...

絞り込み条件を変える

Shell.default_system_path -> Array (7.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) (7.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.install_system_commands(pre = "sys_") -> () (7.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.new(pwd = Dir.pwd, umask = nil) -> Shell (7.0)

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

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

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

Shell.notify(*opts) {|message| ... } -> String (7.0)

@todo

@todo

絞り込み条件を変える

Shell.unalias_command(alias) -> () (7.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.undef_system_command(command) -> Shell::CommandProcessor (7.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.verbose -> bool (7.0)

@todo

@todo

Shell.verbose=(flag) (7.0)

true ならば冗長な出力の設定を行います。

true ならば冗長な出力の設定を行います。

@param flag true ならば冗長な出力の設定を行います。

Shell.verbose? -> bool (7.0)

@todo

@todo

絞り込み条件を変える