るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Shell.def_system_command(command, path = command) -> nil (18119.0)

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

...合はcommand と同じになります。

例)
require 'shell'
Shell.def_system_command "ls"
# ls を定義

Shell.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義

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

Shell.undef_system_command(command) -> Shell::CommandProcessor (6112.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 NameEr...

Shell.alias_command(alias, command, *opts) {...} -> self (34.0)

コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

...コマンドの別名(エイリアス)を作成します。
コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

@param alias エイリアスの名前を文字列で指定します.

@param command コマンド名を文字列で指定します.

@param...
...を指定します.

使用例: 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::Filter#|(filter) -> object (24.0)

パイプ結合を 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...

Shell.unalias_command(alias) -> () (18.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.unalia...

絞り込み条件を変える

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

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

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

動作例
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 +...

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

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

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

動作例
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 +...

Shell#glob(pattern) -> Shell::Filter (12.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 +...

Shell#out(dev = STDOUT, &block) -> () (12.0)

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

...ェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

Shell#system(command, *opts) -> Shell::SystemCommand (12.0)

command を実行する.

...で指定します。

@param opts command のオプションを文字列で指定します。複数可。

使用例:

require 'shell'
Shell.verbose = false
sh = Shell.new

print sh.system("ls", "-l")
Shell.def_system_command("head")
sh.system("ls", "-l") | sh.head("-n 3") > STDOUT...

絞り込み条件を変える

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

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

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

動作例
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 +...

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

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

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

例:

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

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

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

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

動作例
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 +...

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

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

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

動作例
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 +...

Shell::CommandProcessor#glob(pattern) -> Shell::Filter (12.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 +...

絞り込み条件を変える

Shell::CommandProcessor#out(dev = STDOUT, &block) -> () (12.0)

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

...ェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

Shell::CommandProcessor#system(command, *opts) -> Shell::SystemCommand (12.0)

command を実行する.

...で指定します。

@param opts command のオプションを文字列で指定します。複数可。

使用例:

require 'shell'
Shell.verbose = false
sh = Shell.new

print sh.system("ls", "-l")
Shell.def_system_command("head")
sh.system("ls", "-l") | sh.head("-n 3") > STDOUT...
<< 1 2 > >>