mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 19:30:29 +00:00
added example (currently with sideeffects)
This commit is contained in:
parent
e5d1536256
commit
1c7e81492d
1 changed files with 19 additions and 0 deletions
19
examples/helloshell.lua
Normal file
19
examples/helloshell.lua
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
-- o/third_party/lua/lua.com helloshell.lua | sort | uniq
|
||||||
|
-- output:
|
||||||
|
-- 124060
|
||||||
|
-- 130754
|
||||||
|
-- 2924
|
||||||
|
-- 2943
|
||||||
|
-- 2944
|
||||||
|
|
||||||
|
function capture(cmd)
|
||||||
|
local f = io.popen(cmd,'r')
|
||||||
|
local s = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1, 100 do
|
||||||
|
local stdout = capture('ls -laR / 2>&1')
|
||||||
|
print(stdout:len())
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue