ライブラリ
- ビルトイン (14)
- etc (41)
- open3 (9)
- shell (123)
-
shell
/ builtin-command (27) -
shell
/ command-processor (84) -
shell
/ error (5) -
shell
/ filter (80) -
shell
/ process-controller (25) -
shell
/ system-command (17) - shellwords (11)
- socket (1)
- timeout (1)
- win32ole (3)
クラス
- Array (1)
- Dir (2)
-
Etc
:: Passwd (2) - Shell (122)
-
Shell
:: AppendFile (2) -
Shell
:: AppendIO (2) -
Shell
:: BuiltInCommand (2) -
Shell
:: Cat (2) -
Shell
:: CommandProcessor (83) -
Shell
:: Concat (2) -
Shell
:: Echo (2) -
Shell
:: Filter (79) -
Shell
:: Glob (2) -
Shell
:: ProcessController (24) -
Shell
:: SystemCommand (16) -
Shell
:: Tee (2) -
Shell
:: Void (2) - Socket (1)
- String (2)
-
WIN32OLE
_ TYPELIB (1) -
WIN32OLE
_ VARIANT (1)
モジュール
- Etc (39)
- Kernel (12)
- Open3 (9)
- Shellwords (7)
- Timeout (1)
キーワード
- + (1)
- < (1)
- > (1)
- >> (1)
- AppendFile (1)
- AppendIO (1)
- BuiltInCommand (1)
- CantApplyMethod (1)
- CantDefine (1)
- Cat (1)
- CommandNotFound (1)
- CommandProcessor (1)
- Concat (1)
- DirStackEmpty (1)
- Echo (1)
- Error (1)
- Filter (1)
- Glob (1)
- NoDelegateMethods (1)
- ProcessController (1)
-
SC
_ 2 _ LOCALEDEF (1) -
SC
_ 2 _ PBS _ LOCATE (1) -
SC
_ AIO _ LISTIO _ MAX (1) -
SC
_ AIO _ PRIO _ DELTA _ MAX (1) -
SC
_ BC _ SCALE _ MAX (1) -
SC
_ CHILD _ MAX (1) -
SC
_ CLK _ TCK (1) -
SC
_ CLOCK _ SELECTION (1) -
SC
_ COLL _ WEIGHTS _ MAX (1) -
SC
_ DELAYTIMER _ MAX (1) -
SC
_ JOB _ CONTROL (1) -
SC
_ LINE _ MAX (1) -
SC
_ LOGIN _ NAME _ MAX (1) -
SC
_ MAPPED _ FILES (1) -
SC
_ MEMLOCK (1) -
SC
_ MEMLOCK _ RANGE (1) -
SC
_ MONOTONIC _ CLOCK (1) -
SC
_ NPROCESSORS _ ONLN (1) -
SC
_ PRIORITY _ SCHEDULING (1) -
SC
_ READER _ WRITER _ LOCKS (1) -
SC
_ REALTIME _ SIGNALS (1) -
SC
_ SEM _ VALUE _ MAX (1) -
SC
_ SHELL (1) -
SC
_ SPIN _ LOCKS (1) -
SC
_ SS _ REPL _ MAX (1) -
SC
_ SYMLOOP _ MAX (1) -
SC
_ THREAD _ PRIORITY _ SCHEDULING (1) -
SC
_ TRACE _ EVENT _ FILTER (1) -
SC
_ TRACE _ LOG (1) -
SC
_ V6 _ ILP32 _ OFF32 (1) -
SC
_ V6 _ ILP32 _ OFFBIG (1) -
SC
_ V6 _ LP64 _ OFF64 (1) -
SC
_ V6 _ LPBIG _ OFFBIG (1) -
SC
_ V7 _ ILP32 _ OFF32 (1) -
SC
_ V7 _ ILP32 _ OFFBIG (1) -
SC
_ V7 _ LP64 _ OFF64 (1) -
SC
_ V7 _ LPBIG _ OFFBIG (1) -
SC
_ XOPEN _ REALTIME (1) -
SC
_ XOPEN _ REALTIME _ THREADS (1) - Shell (1)
- Shellwords (1)
- SystemCommand (1)
- Tee (1)
-
USING
_ AT _ EXIT _ WHEN _ PROCESS _ EXIT (1) - Void (1)
-
WIN32OLE
_ VARIANT (1) - [] (3)
- activate (1)
- active? (2)
-
active
_ job? (1) -
active
_ jobs (1) -
active
_ jobs _ exist? (1) -
active
_ process _ controllers (1) -
add
_ delegate _ command _ to _ shell (1) -
add
_ schedule (1) -
alias
_ command (3) -
alias
_ map (1) - append (3)
- atime (3)
- basename (3)
-
block
_ output _ synchronize (1) - blockdev? (3)
- cascade (1)
- cascade= (1)
- cat (3)
- cd (2)
- chardev? (3)
- chdir (1)
-
check
_ point (3) - chmod (3)
- chown (3)
- command (1)
-
command
_ processor (1) - concat (3)
- ctime (3)
- cwd (1)
- debug (2)
- debug= (2)
- debug? (2)
-
debug
_ output _ exclusive _ unlock (1) -
debug
_ output _ lock (1) -
debug
_ output _ locked? (1) -
debug
_ output _ synchronize (1) -
debug
_ output _ try _ lock (1) -
debug
_ output _ unlock (1) -
def
_ builtin _ commands (1) -
def
_ system _ command (2) -
default
_ record _ separator (1) -
default
_ record _ separator= (1) -
default
_ system _ path (1) -
default
_ system _ path= (1) - delete (3)
- dir (1)
-
dir
_ stack (1) - directory? (3)
- dirname (3)
- dirs (1)
- each (8)
-
each
_ active _ object (1) - echo (3)
- escape (1)
- exec (4)
- executable? (3)
-
executable
_ real? (3) - exist? (3)
- exists? (3)
- file? (3)
-
find
_ system _ command (3) -
finish
_ all _ jobs (3) - flush (1)
- foreach (3)
- ftype (3)
- getservbyport (1)
- getwd (1)
- glob (5)
- grpowned? (3)
- identical? (3)
- inactivate (1)
- initialize (1)
- input (1)
- input= (4)
- inspect (1)
-
install
_ builtin _ commands (1) -
install
_ system _ commands (2) - jobs (2)
-
jobs
_ exist? (1) - join (4)
- kill (2)
-
kill
_ job (1) - link (3)
- lstat (3)
-
method
_ added (1) - mkdir (3)
- mtime (3)
- name (1)
- new (15)
- notify (6)
- open (3)
-
optparse
/ shellwords (1) - out (3)
- owned? (3)
- pipe? (3)
- pipeline (1)
-
pipeline
_ r (2) -
pipeline
_ rw (2) -
pipeline
_ start (2) -
pipeline
_ w (2) - popd (1)
- popdir (1)
-
process
_ controller (1) -
process
_ controllers _ exclusive (1) - pushd (1)
- pushdir (1)
- pwd (1)
- readable? (3)
-
readable
_ real? (3) - readlink (3)
-
record
_ separator (1) -
record
_ separator= (1) - rehash (3)
- rename (3)
- rm (3)
- rmdir (3)
-
run
_ config (1) - setgid? (3)
- setuid? (3)
- sfork (1)
-
shell
/ builtin-command (1) -
shell
/ command-processor (1) -
shell
/ error (1) -
shell
/ filter (1) -
shell
/ process-controller (1) -
shell
/ system-command (1) - shell= (1)
- shellescape (2)
- shelljoin (2)
- shellsplit (2)
- shellwords (2)
- size (3)
- size? (3)
- socket? (3)
- spawn (4)
- split (4)
- start (1)
-
start
_ export (1) -
start
_ import (1) -
start
_ job (1) - stat (3)
- sticky? (3)
-
super
_ each (1) - symlink (3)
- symlink? (3)
- system (7)
-
system
_ path (1) -
system
_ path= (1) - tee (3)
- terminate (1)
-
terminate
_ job (1) - test (3)
- timeout (1)
-
to
_ a (1) -
to
_ s (1) - transact (3)
- truncate (3)
- umask (1)
- umask= (1)
-
unalias
_ command (2) -
undef
_ system _ command (2) - unlink (3)
- utime (3)
- verbose (2)
- verbose= (2)
- verbose? (2)
- wait? (2)
-
wait
_ all _ jobs _ execution (1) -
wait
_ to _ finish _ all _ process _ controllers (1) -
waiting
_ job? (1) -
waiting
_ jobs (1) -
waiting
_ jobs _ exist? (1) -
world
_ readable? (3) -
world
_ writable? (3) - writable? (3)
-
writable
_ real? (3) - zero? (3)
- | (1)
検索結果
先頭5件
-
shell (132253.0)
-
Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。
Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。
sh/csh の制御文は Ruby の機能を用いて実現します。
=== サンプル
==== Example 1:
require 'shell'
sh = Shell.cd("/tmp")
sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
sh.cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
unless sh.exists?(... -
Shell
:: ProcessController # shell -> Shell (100207.0) -
@todo
@todo -
Shell
# process _ controller -> Shell :: ProcessController (79204.0) -
@todo
@todo -
Shell
. install _ system _ commands(pre = "sys _ ") -> () (78493.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... -
Shell
# kill(signal , job) -> Integer (78301.0) -
@todo
@todo
ジョブにシグナルを送ります。
@param signal
@param job -
Etc
:: Passwd # shell -> String (72604.0) -
このユーザのログインシェルを返します。
このユーザのログインシェルを返します。 -
Shell
. alias _ command(alias , command , *opts) { . . . } -> self (69793.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", "... -
Shell
. unalias _ command(alias) -> () (69781.0) -
commandのaliasを削除します.
commandのaliasを削除します.
@param alias 削除したいエイリアスの名前を文字列で指定します。
@raise NameError alias で指定したコマンドが無い場合に発生します。
使用例: 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.trans... -
Shell
# glob(pattern) -> Shell :: Filter (69694.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、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|
... -
Shell
# delete(*filename) -> Integer (69601.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.delete -
Shell
# executable?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#executable? -
Shell
# executable _ real?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#executable_real? -
Shell
# file?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#file? -
Shell
# readable?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#readable? -
Shell
# readable _ real?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#readable_real? -
Shell
# writable?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#writable? -
Shell
# writable _ real?(file) -> bool (69601.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#writable_real? -
Shell
. default _ system _ path -> Array (69439.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... -
Shell
. default _ system _ path=(path) (69439.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... -
Shell
. default _ record _ separator -> String (69337.0) -
執筆者募集
執筆者募集
Shell で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。
@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定します。 -
Shell
. default _ record _ separator=(rs) (69337.0) -
執筆者募集
執筆者募集
Shell で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。
@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定します。 -
Shell
# blockdev?(file) -> bool (69301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#blockdev? -
Shell
# finish _ all _ jobs (69301.0) -
@todo
@todo -
Shell
# identical? (69301.0) -
@todo
@todo -
Shell
# link(old , new) -> 0 (69301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new ファイル名を表す文字列を指定します。
@see File.link -
Shell
# lstat(filename) -> File :: Stat (69301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.lstat -
Shell
# readlink(path) -> String (69301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path シンボリックリンクを表す文字列を指定します。
@see File.readlink -
Shell
# split(pathname) -> [String] (69301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split -
Shell
# symlink(old , new) -> 0 (69301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new シンボリックリンクを表す文字列を指定します。
@see File.symlink -
Shell
# symlink?(file) -> bool (69301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#symlink? -
Shell
# unlink(path) -> self (69301.0) -
path がファイルなら File.unlink、path がディレクトリなら Dir.unlink の動作をします。
path がファイルなら File.unlink、path がディレクトリなら Dir.unlink の動作をします。
@param path 削除したいパスを指定します。
@see File.unlink, Dir.unlink -
Shell
# world _ readable? (69301.0) -
@todo
@todo -
Shell
# world _ writable? (69301.0) -
@todo
@todo -
Shell
. debug _ output _ exclusive _ unlock { . . . } -> Mutex | nil (69301.0) -
@todo
@todo
@see Mutex#exclusive_unlock -
Shell
. debug _ output _ lock -> Mutex (69301.0) -
@todo
@todo
@see Thread::Mutex#lock -
Shell
. debug _ output _ locked? -> bool (69301.0) -
@todo
@todo
@see Thread::Mutex#locked? -
Shell
. debug _ output _ try _ lock -> bool (69301.0) -
@todo
@todo
@see Thread::Mutex#try_lock -
Shell
. debug _ output _ unlock -> Mutex | nil (69301.0) -
@todo
@todo
@see Thread::Mutex#unlock -
Shell
:: ProcessController . wait _ to _ finish _ all _ process _ controllers -> () (63601.0) -
@todo
@todo -
Shell
# append(to , filter) -> Shell :: AppendFile | Shell :: AppendIO (60925.0) -
@todo
@todo
@param to 文字列か IO を指定します。
@param filter Shell::Filter のインスタンスを指定します。 -
Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor (60730.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 {|l|
puts l
}
}
rescue NameError => err
puts ... -
Shell
# system(command , *opts) -> Shell :: SystemCommand (60712.0) -
command を実行する.
command を実行する.
@param 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
# cat(*files) -> Shell :: Filter (60694.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする 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) | tee(file + ".tee") >> "al... -
Shell
# echo(*strings) -> Shell :: Filter (60694.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする 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(file + ".tee") >> "al... -
Shell
# tee(file) -> Shell :: Filter (60694.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする 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(file + ".tee") >> "all... -
Shell
# [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (60655.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文字列でファイルへのパスを指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m... -
Shell
# test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (60655.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文字列でファイルへのパスを指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m... -
Shell
. new(pwd = Dir . pwd , umask = nil) -> Shell (60652.0) -
プロセスのカレントディレクトリをpwd で指定されたディレクトリとするShellオ ブジェクトを生成します.
プロセスのカレントディレクトリをpwd で指定されたディレクトリとするShellオ
ブジェクトを生成します.
@param pwd プロセスのカレントディレクトリをpwd で指定されたディレクトリとします。
指定しない場合は、Dir.pwd が使用されます。
@param umask ファイル作成の際に用いられる umask を使用します。 -
Shell
# command _ processor -> Shell :: CommandProcessor (60604.0) -
@todo
@todo -
Shell
# concat(*jobs) -> Shell :: Concat (60604.0) -
@todo
@todo -
Shell
# stat(filename) -> File :: Stat (60601.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.stat -
Shell
. def _ system _ command(command , path = command) -> nil (60565.0) -
Shell のメソッドとして command を登録します.
Shell のメソッドとして command を登録します.
OS上のコマンドを実行するにはまず, Shellのメソッドとして定義します.
注) コマンドを定義しなくとも直接実行できる Shell#system コマンドもあります.
@param command Shell のメソッドとして定義するコマンドを文字列で指定します。
@param path command のパスを指定します。
指定しない場合はcommand と同じになります。
例)
require 'shell'
Shell.def_system_command "ls"
# ls ... -
Shell
# out(dev = STDOUT , &block) -> () (60421.0) -
Shell#transact を呼び出しその結果を dev に出力します。
Shell#transact を呼び出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@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
. cd(path = nil , verbose = self . verbose) -> self (60385.0) -
pathをカレントディレクトリとするShellオブジェクトを生成します.
pathをカレントディレクトリとするShellオブジェクトを生成します.
@param path カレントディレクトリとするディレクトリを文字列で指定します。
@param verbose true を指定すると冗長な出力を行います。
使用例
require 'shell'
sh = Shell.new
sh.cd("/tmp") -
Shell
# foreach(path = nil , &block) -> () (60355.0) -
pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach の動作をします。
pathがファイルなら, File#foreach
pathがディレクトリなら, Dir#foreach
の動作をします。
@param path ファイルもしくはディレクトリのパスを文字列で指定します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.foreach("/tmp"){|f|
puts f
} -
Shell
# pushd(path = nil , &block) -> object (60355.0) -
カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.
カレントディレクトリをディレクトリスタックにつみ, カレントディレク
トリをpathにする. pathが省略されたときには, カレントディレクトリと
ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと
きには, ブロック実行中のみpushdする.
@param path カレントディレクトリをpathにする。文字列で指定します。
@param block イテレータとして呼ぶ場合, ブロックを指定します。
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp"... -
Shell
# pushdir(path = nil , &block) -> object (60355.0) -
カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.
カレントディレクトリをディレクトリスタックにつみ, カレントディレク
トリをpathにする. pathが省略されたときには, カレントディレクトリと
ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと
きには, ブロック実行中のみpushdする.
@param path カレントディレクトリをpathにする。文字列で指定します。
@param block イテレータとして呼ぶ場合, ブロックを指定します。
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp"... -
Shell
# cd(path , &block) -> self (60337.0) -
カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.
カレントディレクトリをpathにする. イテレータとして呼ばれたときには
ブロック実行中のみカレントディレクトリを変更する.
@param path カレントディレクトリを文字列で指定します.
@param block path で指定したディレクトリで行う操作をブロックで指定します.
使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
} -
Shell
# chdir(path , &block) -> self (60337.0) -
カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.
カレントディレクトリをpathにする. イテレータとして呼ばれたときには
ブロック実行中のみカレントディレクトリを変更する.
@param path カレントディレクトリを文字列で指定します.
@param block path で指定したディレクトリで行う操作をブロックで指定します.
使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
} -
Shell
# atime(filename) -> Time (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.atime -
Shell
# basename(filename , suffix = "") -> String (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。
@see File.basename -
Shell
# chardev?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#chardev? -
Shell
# chmod(mode , *filename) -> Integer (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param mode chmod(2) と同様に整数で指定します。
@see File.chmod -
Shell
# chown(owner , group , *filename) -> Integer (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param owner chown(2) と同様に数値で指定します。nil または -1 を指定することで、オーナーを現在のままにすることができます。
@param group chown(2) と同様に数値で指定します。nil または -1 を指定することで、グループを現在のままにすることができます。
@param filename ファイル名を表す文字列を指定します。
@see File.chown -
Shell
# ctime(filename) -> Time (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.ctime -
Shell
# debug -> bool | Integer (60301.0) -
@todo
@todo -
Shell
# debug=(flag) (60301.0) -
@todo
@todo -
Shell
# debug? -> bool | Integer (60301.0) -
@todo
@todo -
Shell
# directory?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#directory? -
Shell
# dirname(filename) -> String (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.dirname -
Shell
# exist?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#exist? FileTest.#exists? -
Shell
# exists?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#exist? FileTest.#exists? -
Shell
# ftype(filename) -> String (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.ftype -
Shell
# grpowned?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#grpowned? -
Shell
# mtime(filename) -> Time (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.mtime -
Shell
# open(path , mode) -> File | Dir (60301.0) -
path がファイルなら、 File.open path がディレクトリなら、 Dir.open の動作をします。
path がファイルなら、 File.open path がディレクトリなら、 Dir.open の動作をします。
@param path 開きたいパスを指定します。
@param mode アクセスモードを指定します。path がディレクトリの場合は無視されます。
@see File.open, Dir.open -
Shell
# owned?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#owned? -
Shell
# pipe?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#pipe? -
Shell
# rm(*filename) -> Integer (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.delete -
Shell
# setgid?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#setgid? -
Shell
# setuid?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#setuid? -
Shell
# size(file) -> Integer (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#size FileTest.#size? -
Shell
# size?(file) -> Integer | nil (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#size FileTest.#size? -
Shell
# socket?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#socket? -
Shell
# sticky?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#sticky? -
Shell
# truncate(path , length) -> 0 (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate -
Shell
# utime(atime , mtime , *filename) -> Integer (60301.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param atime 最終アクセス時刻を Time か、起算時からの経過秒数を数値で指定します。
@param utime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。
@see File.utime -
Shell
# verbose -> bool (60301.0) -
@todo
@todo -
Shell
# verbose=(flag) (60301.0) -
@todo
@todo -
Shell
# verbose? -> bool (60301.0) -
@todo
@todo -
Shell
# zero?(file) -> bool (60301.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#zero? -
Shell
. cascade -> bool (60301.0) -
@todo
@todo -
Shell
. cascade=(flag) (60301.0) -
@todo
@todo -
Shell
. debug -> bool | Integer (60301.0) -
@todo
@todo
デバッグ用フラグを参照します。 -
Shell
. debug=(val) (60301.0) -
デバッグ用のフラグを設定します。
デバッグ用のフラグを設定します。
@param val bool 値や整数値を指定します。詳細は下記を参照してください。
# debug: true -> normal debug
# debug: 1 -> eval definition debug
# debug: 2 -> detail inspect debug -
Shell
. debug? -> bool | Integer (60301.0) -
@todo
@todo
デバッグ用フラグを参照します。 -
Shell
. verbose -> bool (60301.0) -
@todo
@todo -
Shell
. verbose=(flag) (60301.0) -
true ならば冗長な出力の設定を行います。
true ならば冗長な出力の設定を行います。
@param flag true ならば冗長な出力の設定を行います。 -
Shell
. verbose? -> bool (60301.0) -
@todo
@todo -
Shell
# transact { . . . } -> object (60139.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 と同じとなる。
}