lua-users home
lua-l archive

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


On Fri, Jul 16, 2010 at 7:51 AM, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Tue, Jul 13, 2010 at 02:06, Alexander Gladysh <agladysh@gmail.com> wrote:
>
>>  sh. gcc { o = file } (file..'.c") .I. grep 'error' .I. sort .out
>
> Um. So, any comments?

I found it too weird, especially if the goal of moving away from sh
scripting is to avoid gotchas caused by weird-and-magic syntax.

I've been playing a bit with the implementation here -- I basically
copied Penlight's path code and added some more command launchers
(sh.lines and sh.tokens, both return generators for "for"). I was in
the process of rewriting a large shell script I have but the process
is proving to be harder than I expected due to the amount of ugly
tricks caused by variable scoping I employed there. So I didn't get to
properly test much of the code I wrote, and therefore I ended up not
committing it yet.

for device, mountpoint, fstype in
fs.tokens.grep("-w","unionfs","/proc/mounts") do
   -- ...
end

-- Hisham