るりまサーチ

最速Rubyリファレンスマニュアル検索!
186件ヒット [1-100件を表示] (0.022秒)
トップページ > クエリ:sh[x] > クエリ:transact[x]

別のキーワード

  1. rake sh
  2. fileutils sh
  3. constants lock_sh
  4. _builtin lock_sh
  5. sync_m sh

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

shell (26160.0)

Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。

...uby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。

sh
/csh の制御文は Ruby の機能を用いて実現します。

=== サンプル

==== Example 1:

require 'shell'
sh
= Shell.cd("/tmp")
sh
.mkdir "shell-test-...
...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")
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)
mkdir dir
cd(dir) do
f = open("tmpFile", "w")
f.print "TEST\n"
f.close...

Shell#transact { ... } -> object (21137.0)

ブロック中で shell を self として実行します。

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

例:

require 'shell'
Sh
ell.def_system_command("head")
sh
= Shell.new
sh
.transact{
system("ls", "-l") | head > STDOUT
# transact の中では、
# sh.system("ls", "-l") | sh.head > STDOUT と同じとなる。
}...

Shell::CommandProcessor#transact { ... } -> object (21137.0)

ブロック中で shell を self として実行します。

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

例:

require 'shell'
Sh
ell.def_system_command("head")
sh
= Shell.new
sh
.transact{
system("ls", "-l") | head > STDOUT
# transact の中では、
# sh.system("ls", "-l") | sh.head > STDOUT と同じとなる。
}...

Shell::Filter#transact { ... } -> object (21137.0)

ブロック中で shell を self として実行します。

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

例:

require 'shell'
Sh
ell.def_system_command("head")
sh
= Shell.new
sh
.transact{
system("ls", "-l") | head > STDOUT
# transact の中では、
# sh.system("ls", "-l") | sh.head > STDOUT と同じとなる。
}...

Shell#cat(*files) -> Shell::Filter (3118.0)

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

...iles シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

絞り込み条件を変える

Shell#echo(*strings) -> Shell::Filter (3118.0)

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

...aram strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

Shell#glob(pattern) -> Shell::Filter (3118.0)

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

...パターンの書式については、Dir.[] を参照してください。

動作例
require 'shell'
Sh
ell.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 +...

Shell#tee(file) -> Shell::Filter (3118.0)

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

...file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

Shell.undef_system_command(command) -> Shell::CommandProcessor (3118.0)

commandを削除します.

...るコマンドの文字列を指定します。

動作例:
require 'shell'
Sh
ell.def_system_command("ls")
# ls を定義
Sh
ell.undef_system_command("ls")
# ls を 削除

sh
= Shell.new
begin
sh
.transact {
ls("-l").each {|l|
puts l
}
}
rescue NameError...

Shell::CommandProcessor#cat(*files) -> Shell::Filter (3118.0)

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

...iles シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

絞り込み条件を変える

Shell::CommandProcessor#echo(*strings) -> Shell::Filter (3118.0)

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

...aram strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

Shell::CommandProcessor#glob(pattern) -> Shell::Filter (3118.0)

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

...パターンの書式については、Dir.[] を参照してください。

動作例
require 'shell'
Sh
ell.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 +...

Shell::CommandProcessor#tee(file) -> Shell::Filter (3118.0)

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

...file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

Shell::Filter#cat(*files) -> Shell::Filter (3118.0)

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

...iles シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

Shell::Filter#echo(*strings) -> Shell::Filter (3118.0)

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

...aram strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...

絞り込み条件を変える

Shell::Filter#glob(pattern) -> Shell::Filter (3118.0)

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

...パターンの書式については、Dir.[] を参照してください。

動作例
require 'shell'
Sh
ell.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 +...

Shell::Filter#tee(file) -> Shell::Filter (3118.0)

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

...file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require 'shell'
Sh
ell.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 +...
<< 1 2 > >>