Example 2: Executing the ls UNIX™ command

This program executes the ls command and displays the filenames and extensions separately.

MAIN
  DEFINE fn CHAR(40)
  DEFINE ex CHAR(10)
  DEFINE ch base.Channel 
  LET ch = base.Channel.create()
  CALL ch.setDelimiter(".")
  CALL ch.openPipe("ls -l","r")
  WHILE ch.read([fn,ex])
    DISPLAY fn, "   ", ex 
  END WHILE
  CALL ch.close()
END MAIN