るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

検索結果

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

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

...ます.

@param command Shell のメソッドとして定義するコマンドを文字列で指定します。

@param path 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_sort("-k 5")).each {|l|
puts l
}
}...