Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > shell/command-processorライブラリ > Shell::CommandProcessorクラス > glob

instance method Shell::CommandProcessor#glob

glob(pattern) -> Shell::Filter[permalink][rdoc]

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

[PARAM] pattern:
シェルコマンド glob に与えるパターンを指定します。パターンの書式については、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 + ".tee") >> "all.tee"
    }
  }
}

[SEE_ALSO] Dir.[]