On Fri, 1 Oct 2004 20:17:14 +0900, Kaspar Schiess <eule / space.ch> wrote:
> Just in case anyone is really interested, the def is
> 
> ~ def method_missing( method, *args )
> ~   system method.to_s + " " + args.join(' ')
> ~ end
> 
> and you could perhaps call
> 
> ~ dir %w{ *.rb }
> 
> ++ for the method missing comment !

... etc.

On the subject (if not the Subject:): Have anybody played with make it
possible to use Ruby for running sort-of shell scripts?  Ie, including
pipes etc.  As it is, there are some programs that call a lot of shell
commands that I write in sh instead of Ruby, and where I'd really like
to do them in Ruby.

The starting point I see for something like this would be to override
method_missing like above, but make it return an object where | is
overridden, and that have handling of shell return codes.

The challenges I see here is 
- It's not possible to override the trueness/falseness of an object,
so we'd need to call a special method to find out if a command failed
or passed
- It is hard to implement -e (give an error if a complete shell line
fails - but not if we have an fail || true).  Maybe trace_func could
be of help here, though.

Eivind.