種類
- インスタンスメソッド (96)
- 文書 (22)
- ライブラリ (6)
- 特異メソッド (6)
ライブラリ
- shell (66)
-
shell
/ command-processor (18) -
shell
/ filter (18)
クラス
- Shell (66)
-
Shell
:: CommandProcessor (18) -
Shell
:: Filter (18)
キーワード
-
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) - chdir (6)
- cwd (6)
- dir (6)
- foreach (18)
- getwd (6)
- glob (18)
- mkdir (18)
- popdir (6)
- pushdir (6)
- pwd (6)
-
ruby 1
. 6 feature (11)
検索結果
先頭5件
-
shell (38180.0)
-
Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。
...サンプル
==== 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.cd(dir) do
f = sh.open("tmpFile", "w")......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)
mkdir dir
cd(dir) do
f = open("tmpFile", "w")......'shell'
sh = Shell.new
sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
(sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
(sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
==== Example 4:
require 'shell'
sh = Shell.new... -
Shell
. new(pwd = Dir . pwd , umask = nil) -> Shell (35325.0) -
プロセスのカレントディレクトリをpwd で指定されたディレクトリとするShellオ ブジェクトを生成します.
...pwd で指定されたディレクトリとするShellオ
ブジェクトを生成します.
@param pwd プロセスのカレントディレクトリをpwd で指定されたディレクトリとします。
指定しない場合は、Dir.pwd が使用されます。
@param umask ファ... -
Shell
# mkdir(*path) -> Array (23140.0) -
Dir.mkdirと同じです。 (複数可)
...
Dir.mkdirと同じです。 (複数可)
@param path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=>... -
Shell
# popdir -> () (20124.0) -
ディレクトリスタックからポップし, それをカレントディレクトリにする.
...ディレクトリスタックからポップし, それをカレントディレクトリにする.
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp")
p sh.cwd #=> "/tmp"
sh.pushd("/usr")
p sh.cwd #=> "/usr"
sh.popd
p sh.cwd #=> "/tmp"... -
Shell
# pushdir(path = nil , &block) -> object (20124.0) -
カレントディレクトリをディレクトリスタックにつみ, カレントディレク トリをpathにする. pathが省略されたときには, カレントディレクトリと ディレクトリスタックのトップを交換する. イテレータとして呼ばれたと きには, ブロック実行中のみpushdする.
...定します。
@param block イテレータとして呼ぶ場合, ブロックを指定します。
動作例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.pushd("/tmp")
p sh.cwd #=> "/tmp"
sh.pushd("/usr")
p sh.cwd #=> "/usr"
sh.popd
p sh.cwd #=> "/tmp"
sh.pushd("/... -
Shell
# dir -> String (20119.0) -
カレントディレクトリのパスを文字列で返します。
...カレントディレクトリのパスを文字列で返します。
使用例
require 'shell'
sh = Shell.new
p sh.cwd
# 例
#=> "/Users/kouya/tall"... -
Shell
# chdir(path , &block) -> self (20118.0) -
カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.
...レクトリを文字列で指定します.
@param block path で指定したディレクトリで行う操作をブロックで指定します.
使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
}... -
Shell
# glob(pattern) -> Shell :: Filter (17137.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...、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|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
# foreach(path = nil , &block) -> () (17040.0) -
pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach の動作をします。
...なら, File#foreach
pathがディレクトリなら, Dir#foreach
の動作をします。
@param path ファイルもしくはディレクトリのパスを文字列で指定します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.foreach("/tmp"){|f|
puts f
}... -
Shell
# cwd -> String (17019.0) -
カレントディレクトリのパスを文字列で返します。
...カレントディレクトリのパスを文字列で返します。
使用例
require 'shell'
sh = Shell.new
p sh.cwd
# 例
#=> "/Users/kouya/tall"... -
Shell
# getwd -> String (17019.0) -
カレントディレクトリのパスを文字列で返します。
...カレントディレクトリのパスを文字列で返します。
使用例
require 'shell'
sh = Shell.new
p sh.cwd
# 例
#=> "/Users/kouya/tall"... -
Shell
# pwd -> String (17019.0) -
カレントディレクトリのパスを文字列で返します。
...カレントディレクトリのパスを文字列で返します。
使用例
require 'shell'
sh = Shell.new
p sh.cwd
# 例
#=> "/Users/kouya/tall"... -
Shell
:: CommandProcessor # mkdir(*path) -> Array (9140.0) -
Dir.mkdirと同じです。 (複数可)
...
Dir.mkdirと同じです。 (複数可)
@param path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=>... -
Shell
:: Filter # mkdir(*path) -> Array (9140.0) -
Dir.mkdirと同じです。 (複数可)
...
Dir.mkdirと同じです。 (複数可)
@param path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=>... -
NEWS for Ruby 2
. 6 . 0 (6120.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.6.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......しているため 4352、
この新しいメソッドを用いることが今後は推奨されます。
* Dir
* 新規メソッド
* Dir#each_child と Dir#children 追加 13969
* Enumerable
* 新規メソッド
* Enumerable#chain はレシーバと引数のそ......ました。
* e2mmap
* forwardable
* irb
* logger
* matrix
* mutex_m
* ostruct
* prime
* rexml
* rss
* shell
* sync
* thwait
* tracer
* BigDecimal
* 以下のメソッドが削除されました。
* BigDecimal.allocate
* Bi... -
NEWS for Ruby 2
. 7 . 0 (6084.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......されました。
その結果、「0 <=> 0i」がNoMethodErrorを発生しなくなりました。 15857
* Dir
* 変更されたメソッド
* Dir.globとDir.[] がNUL文字区切りのグロブパターンを受け付けなくなりました。
代わりにArrayを......機能を使う場合は対応する gem をインストールしてください。
* CMath (cmath gem)
* Scanf (scanf gem)
* Shell (shell gem)
* Synchronizer (sync gem)
* ThreadsWait (thwait gem)
* E2MM (e2mmap gem)
* Proc
* Proc#to_sの形式が変更さ... -
ruby 1
. 6 feature (3402.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...00019>))
: 2002-09-11: Queue#((<Queue/pop>))
Queue#pop に競合状態の問題がありました ((<ruby-dev:17223>))
: 2002-09-11: SizedQueue.new
引数に 0 以下を受けつけるバグが修正されました。
: 2002-09-05: ((<リテラル/式展開>))
stable snapshot で、一......(2002-07-30) [i586-linux]
["a", "b", "c"]
: 2002-06-15 Dir.glob
リンクの切れたシンボリックリンクに対して、Dir.glob がマッチしません
でした。
File.symlink("foo", "bar")
p Dir.glob("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]......ify frozen string (TypeError)
%w(foo bar bar baz).uniq[0].upcase!
=> -:1:in `upcase!': can't modify frozen string (TypeError)
: ((<shell>))
shell 0.6 が標準ライブラリとして新規に追加されました。
(ドキュメントが doc ディレクトリにあります)
:...