On Saturday 17 March 2001 21:10, Ron Jeffries wrote: > Using cmd /c makes it type OK but it still doesn't DO anything. Am I > right that what this bizarre, intricate and non-working code is > supposed to do is eval the contents of file whatever.rb? Sure looks > that way to me. > > Nearly as I can tell, the type command, when executed under Ruby, > doesn't answer the stuff typed out, how nice. > > I guess I'll have to figure out the quickest way to get the contents > of a file now ... ;-> How hard could that be? > > Thanks ... off to the next step in a slow learning process ... > > R > > On Sun, 18 Mar 2001 05:22:07 +0900, Dave Thomas > > <Dave / PragmaticProgrammer.com> wrote: > >Ron Jeffries <ronjeffries / acm.org> writes: > >> Replacing cat with type, however, results in the similar message as > >> before, for example: > > > >I believe that 'type' is built in to the windows command processor, so > >you'll need to make it > > > > cmd /c type ... > > > >(or command /c type ... depending on what you're running) You can try > >this from the command line to check. > > > > > > In the Unix world, things like ls (win=dir) and cat (win=type) are separate programsd; in the Windows world, many of these actions are built into command.com. Thus, in Ruby, %x{cat myfile.txt} delievers results (as would %x{cat myfile.txt | grep "Quoth the Raven"} In Windows, it might be better to "Rubyfy" all the way. For example: File.open("myfile.txt").readlines.each do |line| puts line end will produce the same reult as C:> type myfile.txt from the command line in Windows (actually Dos). Neither way is better or worse than the other (ok, some people _do_ have strong opinions on this _and_ there may be some small technical issues re efficiency) and the bottom line is when in Windows do as Windows does. :-) Now, ESR describes Unix as transcending the issue of OS and becomes a "way of thinking". Read into that what you will. :-) Hope this helps a bit. Regards, Kent Starr elderburn / mindspring.com