home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / rkr_rexx.lzh / command.rexx next >
Encoding:
OS/2 REXX Batch file  |  1995-02-13  |  527 b   |  22 lines

  1. /*
  2. **  $Id: command.rexx,v 1.1 1995/02/12 22:14:00 rkr Exp $
  3. **
  4. **  Execute an AmigaDOS command and return the output.
  5. **
  6. **  CAREFUL: If a command does NOT return any output, this script WILL lock
  7. **  up!
  8. **
  9. */
  10. parse arg cmd
  11.     ret = ''
  12.     pipe_file = 'pipe:command.'pragma( 'i' )
  13.     if open( pipe_file, pipe_file, 'r' ) then
  14.     do
  15.         address command cmd '>'pipe_file
  16.         do while ~eof( pipe_file )
  17.             ret = ret || readch( pipe_file, 4096 )
  18.         end
  19.         call close( pipe_file )
  20.     end
  21. return ret
  22.