[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Shell commands in Lua
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 1 Jun 2012 10:10:58 +0200
On Fri, Jun 1, 2012 at 10:05 AM, Sandeep Ghai <sandeep.ghai92@gmail.com> wrote:
> I searched internet but didnt find anything relevant.
> Any help would be appreciated.
No _direct_ way to do this, but you can always use os.execute for
shell commands (works like C's system)
local tmpfile = os.tmpname()
os.execute("ls -1 > "..tmpfile)
... can now open tmpfile
for this it's easier to use io.popen
local f = io.popen("ls - 1")
for line in f:lines() do
...
end
f:close()
steve d.