lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Nov 17, 2011 at 10:52 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Thu, Nov 17, 2011 at 11:20 AM, Natanael Copa <natanael.copa@gmail.com> wrote:
>> Since this means we will replace lots of shell scripts with lua, are
>> there any lua modules for typical shell things? like mv, cp, ps, kill
>> etc.
>
> Sounds like a fantastic idea and well-worth supporting!
>
> It's possible to get more natural notation with shell commands:
>
> http://lua-users.org/lists/lua-l/2009-06/msg00319.html

Yeah, definitively something in this direction - but this does forks.
I want avoid forks.

> I _distinctly_ remember that Hisham and a few others were getting
> excited about a 'lua shell' library which would support pipelines and
> the like, but I can't find the reference.

I also have a vauge memory about a similar discussion and also could
not find the reference.

pipelines.. hum... i wonder if it would be possible/desireable to pass
over iterators and/or callbacks to provide simlar functionallity as
pipes. We are here talking about lua functions that pass data over to
other lua function rather than a process passing over data to other
process.

like:

sh.find({ name = "*.lua" }, function(path)
   print("luafile found:", path)
end)

or:

for path in sh.find{name = "*.lua"} do
  print("Lua file found:", path)
end

> Otherwise, I imagine that luaposix will get you most of the way.

luaposix gives the stuff you find with 'man 3' . I'm currently looking
for the posix stuff you find in 'man 1'. This stuff is probably best
implemented in lua, (with luaposix as backend?)

The stuff here:
http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html

-- 
Natanael Copa