131件ヒット
[1-100件を表示]
(0.058秒)
種類
- インスタンスメソッド (78)
- モジュール関数 (19)
- 文書 (16)
- 特異メソッド (12)
- ライブラリ (6)
ライブラリ
- shell (36)
-
shell
/ command-processor (24) -
shell
/ filter (30) - timeout (19)
クラス
- Shell (36)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (30)
モジュール
- Timeout (19)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (5) - [] (18)
- append (18)
- mkdir (18)
-
ruby 1
. 6 feature (11) - test (18)
- timeout (19)
-
unalias
_ command (6) -
undef
_ system _ command (6) - | (6)
検索結果
先頭5件
-
shell (38198.0)
-
Ruby 上で 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?(dir)
sh.mkdir dir
sh......f.puts "TEST"
f.close
end
print sh.pwd
end
end
==== Example 2:
require 'shell'
sh = Shell.cd("/tmp")
sh.transact do
mkdir "shell-test-1" unless exists?("shell-test-1")
cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
if !exists?(dir)......cd(dir) do
f = open("tmpFile", "w")
f.print "TEST\n"
f.close
end
print pwd
end
end
end
==== Example 3: Using Pipe
require 'shell'
sh = Shell.new
sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
(sh.cat < "/etc/printcap") | sh.te... -
Shell
# append(to , filter) -> Shell :: AppendFile | Shell :: AppendIO (23608.0) -
@todo
...@todo
@param to 文字列か IO を指定します。
@param filter Shell::Filter のインスタンスを指定します。... -
Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor (17231.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 NameError => err
puts err
end... -
Shell
. unalias _ command(alias) -> () (17160.0) -
commandの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.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}
Shell.unalias_command......("lsla")
begin
Shell.unalias_command("lsla")
rescue NameError => err
puts err
end... -
Shell
# [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (17124.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
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"] # => tru... -
Shell
# mkdir(*path) -> Array (17124.0) -
Dir.mkdirと同じです。 (複数可)
...ram path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end... -
Shell
# test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (17124.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
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"] # => tru... -
Shell
:: CommandProcessor # append(to , filter) -> Shell :: AppendFile | Shell :: AppendIO (9608.0) -
@todo
...@todo
@param to 文字列か IO を指定します。
@param filter Shell::Filter のインスタンスを指定します。... -
Shell
:: Filter # append(to , filter) -> Shell :: AppendFile | Shell :: AppendIO (9608.0) -
@todo
...@todo
@param to 文字列か IO を指定します。
@param filter Shell::Filter のインスタンスを指定します。... -
ruby 1
. 6 feature (5562.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...グ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) -> stable-snapshot
: 2003-01-22: errno
EAGAIN と EWOULDBLOCK が同じ値の......02-07-30) [i586-linux]
: 2002-05-20 IO#close
双方向のパイプの dup を close_write するとエラーになっていました。
((<ruby-dev:17155>))
open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end
}
=> ruby 1.6.7 (2002-03-01......いました。((<ruby-list:29665>))
(%w(foo bar) & %w(foo baz))[0].upcase!
=> -:1:in `upcase!': can't modify frozen string (TypeError)
%w(foo bar bar baz).uniq[0].upcase!
=> -:1:in `upcase!': can't modify frozen string (TypeError)
: ((<shell>))
shell 0.6 が標準ライブ... -
Shell
:: Filter # |(filter) -> object (3142.0) -
パイプ結合を filter に対して行います。
...て行います。
@param filter Shell::Filter オブジェクトを指定します。
@return filter を返します。
使用例
require 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
i = 1......while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}... -
Shell
:: CommandProcessor # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (3124.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
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"] # => tru... -
Shell
:: CommandProcessor # mkdir(*path) -> Array (3124.0) -
Dir.mkdirと同じです。 (複数可)
...ram path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end... -
Shell
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (3124.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
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"] # => tru... -
Shell
:: Filter # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (3124.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
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"] # => tru... -
Shell
:: Filter # mkdir(*path) -> Array (3124.0) -
Dir.mkdirと同じです。 (複数可)
...ram path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end...