sh(*cmd) {|result, status| ... }Ruby 1.9.3 から[permalink][rdoc][edit] [added by rake]-
与えられたコマンドを実行します。
与えられた引数が複数の場合、シェルを経由しないでコマンドを実行します。
- [PARAM]
cmd: - 引数の解釈に関しては Kernel?.exec を参照してください。
sh %{ls -ltr} sh 'ls', 'file with spaces' # check exit status after command runs sh %{grep pattern file} do |ok, res| if ! ok puts "pattern not found (status = #{res.exitstatus})" end end[SEE_ALSO] Kernel?.exec, Kernel?.system
- [PARAM]