From 99d0354e89aefdb6373dbeb22506216b8790a0bd Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 16 Jan 1998 12:13:05 +0000 Subject: Initial revision git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/fullpath.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sample/fullpath.rb (limited to 'sample/fullpath.rb') diff --git a/sample/fullpath.rb b/sample/fullpath.rb new file mode 100644 index 000000000..ce268e20b --- /dev/null +++ b/sample/fullpath.rb @@ -0,0 +1,23 @@ +#! /usr/local/bin/ruby +# convert ls-lR filename into fullpath. + +if ARGV[0] =~ /-p/ + ARGV.shift + path = ARGV.shift +end + +if path == nil + path = "" +elsif path !~ /\/$/ + path += "/" +end + +while gets() + if /:$/ + path = $_.chop.chop + "/" + elsif /^total/ || /^d/ + elsif /^(.*\d )(.+)$/ + print($1, path, $2, "\n") + end +end + -- cgit