Task
Execute a system command and get its output into the program. The output may be stored in any kind of collection (array, list, etc.).




Related task
  Execute a system command


// Rosetta Code problem: https://www.rosettacode.org/wiki/Get_system_command_output
// by Jjuanhdez, 06/2022
 
if peek$("os") = "unix" then
  c$ = "ls *"
else        //"windows"
  c$ = "dir *.*"
fi
 
open("dir_output.txt") for writing as #1
print #1 system$(c$)
close #1