Ruby 1.9.0 リファレンスマニュアル > ライブラリ一覧 > shellライブラリ > Shellクラス

class Shell

クラスの継承リスト: Shell < Object < Kernel < BasicObject

要約

Shellオブジェクトはカレントディレクトリを持ち, コマンド実行はそこからの相対パスになります.

特異メソッド

定義 説明
alias_command(ali, command, *opts) {...}

commandのaliasをします.

cd(path)

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

debug
debug?
debug=(val)
def_system_command(command, path = command)

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

default_record_separator
default_record_separator=(rs)
default_system_path
default_system_path=(path)
install_system_commands(pre = "sys_")

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

new

プロセスのカレントディレクトリをカレントディレクトリとするShellオ ブジェクトを生成します.

unalias_command(ali)

commandのaliasを削除します.

undef_system_command(command)

commandを削除します.

verbose
verbose?
verbose=

インスタンスメソッド

定義 説明
test(command, file1, file2)
self[command, file1, file2]

ファイルテスト関数testと同じ.

atime(file)

Fileクラスにある同名のクラスメソッドと同じです.

basename(file, *opt)

Fileクラスにある同名のクラスメソッドと同じです.

blockdev?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

echo(*strings)
cat(*files)
glob(patten)
tee(file)

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

cd(path, &block)
chdir

カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.

chardev?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

chmod(mode, *files)

Fileクラスにある同名のクラスメソッドと同じです.

chown(owner, group, *file)

Fileクラスにある同名のクラスメソッドと同じです.

cmp

Shell#compare と同じです。

compare(filename_from, filename_to)

FileToolsクラスにある同名のクラスメソッドと同じです.

copy(filename_from, filename_to)

FileToolsクラスにある同名のクラスメソッドと同じです.

cp

Shell#copy と同じです。

ctime(file)

Fileクラスにある同名のクラスメソッドと同じです.

cwd
dir
getwd
pwd

カレントディレクトリを返す。

debug
debug?
debug=(val)
delete(*file)

Fileクラスにある同名のクラスメソッドと同じです.

directory?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

dirname(file)

Fileクラスにある同名のクラスメソッドと同じです.

executable?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

executable_real?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

exist?(file)
exists?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

expand_path(path)
file?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

foreach(path = nil, &block)

pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach

ftype(file)

Fileクラスにある同名のクラスメソッドと同じです.

grpowned?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

install(filename_from, filename_to, mode)

FileToolsクラスにある同名のクラスメソッドと同じです.

jobs

スケジューリングされているjobの一覧を返す.

join(*file)

Fileクラスにある同名のクラスメソッドと同じです.

kill(sig, job)

jobにシグナルsigを送る

link(file_from, file_to)

Fileクラスにある同名のクラスメソッドと同じです.

lstat(file)

Fileクラスにある同名のクラスメソッドと同じです.

makedirs(*filenames)

FileToolsクラスにある同名のクラスメソッドと同じです.

mkdir(*path)

Dir.mkdirと同じ (複数可)

mkpath

Shell#makedirs と同じです。

move(filename_from, filename_to)

FileToolsクラスにある同名のクラスメソッドと同じです.

mtime(file)

Fileクラスにある同名のクラスメソッドと同じです.

mv

Shell#move と同じです。

open(path, mode)

pathがファイルなら, File#open pathがディレクトリなら, Dir#open

out(dev = STDOUT, &block)

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

owned?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

pipe?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

popd
popdir

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

pushd(path = nil, &block)
pushdir

カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.

readable?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

readable_real?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

readlink(file)

Fileクラスにある同名のクラスメソッドと同じです.

rehash

リハッシュする

rename(file_from, file_to)

Fileクラスにある同名のクラスメソッドと同じです.

rm_f

Shell#safe_unlink と同じです。

rmdir(*path)

Dir.rmdirと同じ (複数可)

safe_unlink(*filenames)

FileToolsクラスにある同名のクラスメソッドと同じです.

setgid?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

setuid?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

size(file)
size?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

socket?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

split(file)

Fileクラスにある同名のクラスメソッドと同じです.

stat(file)

Fileクラスにある同名のクラスメソッドと同じです.

sticky?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

symlink(file_from, file_to)

Fileクラスにある同名のクラスメソッドと同じです.

symlink?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

syscopy(filename_from, filename_to)

FileToolsクラスにある同名のクラスメソッドと同じです.

system(command, *opts)

commandを実行する.

system_path
system_path=(path)

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

transact { ... }

ブロック中では shell を self として実行する.

truncate(file, length)

Fileクラスにある同名のクラスメソッドと同じです.

umask

umaskを返す。

unlink(path)

pathがファイルなら, File#unlink pathがディレクトリなら, Dir#unlink

utime(atime, mtime, *file)

Fileクラスにある同名のクラスメソッドと同じです.

verbose
verbose?
verbose=
writable?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

writable_real?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

zero?(file)

FileTestクラスにある同名のクラスメソッドと同じです.

継承したメソッド

! != == === =~ __id__ __send__ _dump class clone dclone display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy inspect instance_eval instance_exec instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? marshal_dump marshal_load method method_missing methods nil? pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods public_methods remove_instance_variable respond_to? singleton_method_added singleton_method_removed singleton_method_undefined singleton_methods taint tainted? tap to_a to_ary to_hash to_int to_io to_proc to_regexp to_s to_splat to_str to_yaml to_yaml_properties to_yaml_style untaint