るりまサーチ

最速Rubyリファレンスマニュアル検索!
18件ヒット [1-18件を表示] (0.020秒)

別のキーワード

  1. shell/builtin-command new
  2. etc sc_shell
  3. shell/builtin-command each
  4. shell cd
  5. shell notify

ライブラリ

クラス

検索結果

shell (38126.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...
...re '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#cd(path, &block) -> self (35125.0)

カレントディレクトリを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 (20025.0)

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

...レクトリを文字列で指定します.

@param block path で指定したディレクトリで行う操作をブロックで指定します.

使用例
require 'shell'
sh = Shell.new
sh.transact {
cd
("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
}...