From: nobu.nokada@... Date: 2004-05-13T19:09:31+09:00 Subject: Re: any ideas for a shell based on Ruby? Hi, At Fri, 7 May 2004 21:53:59 +0900, Martinus wrote in [ruby-talk:99490]: > Recently I have played with the idea of writing a shell based on ruby. > I think this would be pretty cool, consider the following syntax: > > user@machine ~> ls.sort(:time).last.rm > > removes the oldest file in current directory: > 1. ls returns a special array of Filename objects > 2. The array is sorted by the attribute :date > 3. the last element is chosen from the array > 4. the file removes itself $ irb -r pathname irb(main):001:0> def ls(*path) irb(main):002:1> path=["*"] if path.empty? irb(main):003:1> path.collect {|p| irb(main):004:2* begin irb(main):005:3* p = File.join(p,"*") if File.lstat(p).directory? irb(main):006:3> rescue SystemCallError irb(main):007:3> end irb(main):008:2> Dir.glob(p) irb(main):009:2> }.flatten.collect(&Pathname.method(:new)) irb(main):010:1> end => nil irb(main):011:0> ls.sort_by{|p|p.mtime}.last => # irb(main):012:0> > I am looking for other good ideas that justify creating such a ruby > based shell :-) Give a glance at lib/shell. And irbsh may clue. http://raa.ruby-lang.org/list.rhtml?name=irbsh -- Nobu Nakada