From 0dc342de848a642ecce8db697b8fecd83a63e117 Mon Sep 17 00:00:00 2001 From: yugui Date: Mon, 25 Aug 2008 15:02:05 +0000 Subject: added tag v1_9_0_4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- trunk/sample/less.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 trunk/sample/less.rb (limited to 'trunk/sample/less.rb') diff --git a/trunk/sample/less.rb b/trunk/sample/less.rb new file mode 100644 index 0000000000..8be359108f --- /dev/null +++ b/trunk/sample/less.rb @@ -0,0 +1,17 @@ +#! /usr/local/bin/ruby + +ZCAT = "/usr/local/bin/zcat" +LESS = "/usr/local/bin/less" + +FILE = ARGV.pop +OPTION = (if ARGV.length == 0; "" else ARGV.join(" "); end) + +if FILE =~ /\.(Z|gz)$/ + exec(format("%s %s | %s %s", ZCAT, FILE, LESS, OPTION)) +elsif FILE == nil + exec(format("%s %s", LESS, OPTION)) +else + print(format("%s %s %s", LESS, OPTION, FILE), "\n") + exec(format("%s %s %s", LESS, OPTION, FILE)) +end +exit() -- cgit v1.2.3