summaryrefslogtreecommitdiffstats
path: root/lib/shell/builtin-command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shell/builtin-command.rb')
-rw-r--r--lib/shell/builtin-command.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/shell/builtin-command.rb b/lib/shell/builtin-command.rb
index db1adfa48..cfdbc046a 100644
--- a/lib/shell/builtin-command.rb
+++ b/lib/shell/builtin-command.rb
@@ -1,9 +1,9 @@
#
# shell/builtin-command.rb -
-# $Release Version: 0.6.0 $
+# $Release Version: 0.7 $
# $Revision$
# $Date$
-# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
@@ -22,6 +22,16 @@ class Shell
end
end
+ class Void < BuiltInCommand
+ def initialize(sh, *opts)
+ super sh
+ end
+
+ def each(rs = nil)
+ # do nothing
+ end
+ end
+
class Echo < BuiltInCommand
def initialize(sh, *strings)
super sh
@@ -58,20 +68,17 @@ class Shell
super sh
@pattern = pattern
- Thread.critical = true
- back = Dir.pwd
- begin
- Dir.chdir @shell.cwd
- @files = Dir[pattern]
- ensure
- Dir.chdir back
- Thread.critical = false
- end
end
def each(rs = nil)
+ if @pattern[0] == ?/
+ @files = Dir[@pattern]
+ else
+ prefix = @shell.pwd+"/"
+ @files = Dir[prefix+@pattern].collect{|p| p.sub(prefix, "")}
+ end
rs = @shell.record_separator unless rs
- for f in @files
+ for f in @files
yield f+rs
end
end