るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.016秒)
トップページ > バージョン:2.3.0[x] > モジュール:Kernel[x] > クエリ:puts[x] > クエリ:exec[x]

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. zlib puts
  5. io puts

ライブラリ

検索結果

Kernel.#exec(command, options={}) -> () (54379.0)

引数で指定されたコマンドを実行します。

引数で指定されたコマンドを実行します。

プロセスの実行コードはそのコマンド(あるいは shell)になるので、
起動に成功した場合、このメソッドからは戻りません。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。

@param command コマンドを文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options...

Kernel.#exec(env, command, options={}) -> () (54379.0)

引数で指定されたコマンドを実行します。

引数で指定されたコマンドを実行します。

プロセスの実行コードはそのコマンド(あるいは shell)になるので、
起動に成功した場合、このメソッドからは戻りません。

=== 引数の解釈

この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。

@param command コマンドを文字列で指定します。
@param env 更新する環境変数を表す Hash
@param options...

Kernel.#exec(env, program, *args, options={}) -> () (54379.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

Kernel.#exec(program, *args, options={}) -> () (54379.0)

引数で指定されたコマンドを実行します。

...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。

=== 引数の解釈

この形式で呼び出した場合、空白や shell のメタキャラクタも
...
...替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep

@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)...

Kernel.#`(command) -> String (58.0)

command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。

...タスを得るには、$? を参照します。

コマンドの出力を得る必要がなく、単にコマンドを実行したいだけなら
Kernel
.#system を使います。特に端末を制御するコマンドでは
`command` は失敗するかもしれません。

d:spec/literal#command...
...Errno::EXXX コマンドを実行できないときや失敗した場合に発生します。

//emlist[例][ruby]{
puts `ruby -v` #=> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
puts $?.inspect #=> #<Process::Status: pid=3580,exited(0)>
//}

@see Kernel.#system,Kernel.#exec,Kernel.#spawn...

絞り込み条件を変える