RosettaCodeData/Task/Execute-a-system-command/Lua/execute-a-system-command.lua

7 lines
215 B
Lua
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
-- just executing the command
os.execute("ls")
-- to execute and capture the output, use io.popen
local f = io.popen("ls") -- store the output in a "file"
print( f:read("*a") ) -- print out the "file"'s content