221件ヒット
[1-100件を表示]
(0.159秒)
種類
- インスタンスメソッド (180)
- 特異メソッド (30)
- 文書 (11)
ライブラリ
- shell (48)
-
shell
/ command-processor (30) -
shell
/ filter (78) -
shell
/ system-command (54)
クラス
- Shell (48)
-
Shell
:: CommandProcessor (30) -
Shell
:: Filter (78) -
Shell
:: SystemCommand (54)
キーワード
- < (6)
- >> (6)
- active? (6)
-
alias
_ command (6) - cat (18)
-
def
_ system _ command (6) - echo (18)
- glob (18)
-
install
_ system _ commands (12) - kill (6)
- name (6)
- notify (12)
- out (6)
-
ruby 1
. 8 . 4 feature (11) -
start
_ import (6) - tee (18)
- terminate (6)
-
to
_ a (6) -
to
_ s (6) - transact (6)
-
unalias
_ command (6) - wait? (6)
- | (6)
検索結果
先頭5件
-
Shell
:: SystemCommand # command -> String (27301.0) -
@todo
@todo
コマンド名を返します。 -
Shell
:: Filter # system(command , *opts) -> Shell :: SystemCommand (24660.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 . install _ system _ commands(prefix = "sys _ ") -> () (24401.0) -
全てのシステムコマンドをメソッドとして定義します。
...うプレフィクスが付きます。
また、メソッド名として使用できない文字は全て "_" に置換してメソッドを定義します。
このメソッドの実行中に発生した例外は単に無視されます。
@param prefix プレフィクスを指定します。... -
Shell
:: Filter # >(to) -> self (24124.0) -
toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。
...に, IOオブジェクトであれ
ばそれをそのまま出力とする。
@param to 出力先を指定します。文字列ならばファイルに,IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.tran......sact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd") > "tail.out" # と同じ.
}... -
Shell
. install _ system _ commands(pre = "sys _ ") -> () (21423.0) -
system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.
...
system_path上にある全ての実行可能ファイルを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
. def _ system _ command(command , path = command) -> nil (15768.0) -
Shell のメソッドとして command を登録します.
...Shell のメソッドとして command を登録します.
OS上のコマンドを実行するにはまず, Shellのメソッドとして定義します.
注) コマンドを定義しなくとも直接実行できる Shell#system コマンドもあります.
@param command Shell のメソッド......m path command のパスを指定します。
指定しない場合はcommand と同じになります。
例)
require 'shell'
Shell.def_system_command "ls"
# ls を定義
Shell.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義
sh = Shell.n......ew
sh.transact {
ls.each { |l|
puts l
}
(ls("-l") | sys_sort("-k 5")).each {|l|
puts l
}
}... -
Shell
. alias _ command(alias , command , *opts) { . . . } -> self (15576.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
. unalias _ command(alias) -> () (15459.0) -
commandのaliasを削除します.
...
commandのaliasを削除します.
@param alias 削除したいエイリアスの名前を文字列で指定します。
@raise NameError alias で指定したコマンドが無い場合に発生します。
使用例: ls -la | sort -k 5 のような例。
require 'shell'
Shell.def_system_co......mmand("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("lsla")
rescue NameError => err
puts err... -
Shell
:: SystemCommand # active? -> bool (15200.0) -
@todo
@todo -
Shell
:: SystemCommand # kill(signal) -> Integer (15200.0) -
自身のプロセスにシグナルを送ります。
...m signal シグナルを整数かその名前の文字列で指定します。
負の値を持つシグナル(あるいはシグナル名の前に-)を指定すると、
プロセスではなくプロセスグループにシグナルを送ります。
@see Process.#kill... -
Shell
:: SystemCommand # notify(*opts) -> String (15200.0) -
@todo
...@todo
@param opts
@see Shell#notify... -
Shell
:: SystemCommand # notify(*opts) {|message| . . . } -> String (15200.0) -
@todo
...@todo
@param opts
@see Shell#notify... -
Shell
:: SystemCommand # start _ import -> () (15200.0) -
@todo
@todo -
Shell
:: SystemCommand # terminate -> () (15200.0) -
@todo
@todo -
Shell
:: SystemCommand # wait? -> bool (15200.0) -
@todo
@todo -
Shell
:: SystemCommand # name -> String (12201.0) -
@todo
@todo
コマンド名を返します。 -
Shell
:: Filter # >>(to) -> self (12112.0) -
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。
...に, IOオブジェクトであれば
それをそのまま出力とする。
@param to 出力先を指定します。文字列ならばファイルに、IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.tr......ansact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}...