Hi Tim,

All right, To illustrate what happens i have add a puts command to the 
code ! the result is so bizzare!!!
Here is the code again:


        def handleCommandLine(input)
           #splits the command line
      command = input.split('|').map{|c|word_list(c)}
           i = 0
     while i< command.length
    commands = command.at(i)
    puts commands , "...........\n"
          execute(commands)
    i +=1
    end
     end
   def execute(commands)
  rd, wr = IO.pipe
    if fork.nil?
    # child
    rd.close
    $stdout.reopen(wr)
    wr.close
    exec(*commands)
    exit
    else
    # parent
     wr.close
    $stdin.reopen(rd)
     rd.close
     Process.wait
      end
            end



so i used this to test it

001>ls | grep D



here is the result!! the correct result must be 001>Desktop and it has 
to stop there!!!




ls
...........
grep
D
...........
001>Desktop
...........
Test.rb:45:in `exec': No such file or directory - Desktop 
(Errno::ENOENT)
        from Test.rb:45:in `execute'
        from Test.rb:32:in `handleCommandLine'
        from Test.rb:20:in `run'
        from Test.rb:17:in `loop'
        from Test.rb:17:in `run'
        from Test.rb:68


thanks a lot

Fara
-- 
Posted via http://www.ruby-forum.com/.