Task

Run either the   ls   system command   (dir   on Windows),   or the   pause   system command.




Related task
  Get system command output


/* NetRexx */
options replace format comments java crossref symbols binary
 
import java.util.Scanner
 
runSample(arg)
return
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
  parse arg command
  if command = '' then command = 'ls -oa' -- for Windows change to: 'cmd /C dir'
  do
    say 'Executing command:' command
    jprocess = Runtime.getRunTime().exec(command)
    jscanner = Scanner(jprocess.getInputStream())
    loop label scanning while jscanner.hasNext()
      say jscanner.nextLine()
      end scanning
  catch ex = IOException
    ex.printStackTrace()
  end
  return
 