lua-users home
lua-l archive

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


On Tue, Apr 24, 2012 at 10:13, Jay Carlson <nop@nop.com> wrote:
> On Mon, Apr 23, 2012 at 9:46 PM, Coda Highland <chighland@gmail.com> wrote:
>
> I think you'll end up reimplementing xargs in Lua, or to keep the
> process parallelism, wrapping it enough that you can hand in a Lua
> array and not have to worry about syntax. On the positive side, wraps
> stand a chance of fixing long-standing problems--create a file named
> "-i" in the current directory and watch scripts using "*" blow up
> spectacularly. Wrap enough stuff and it starts to look like PowerShell
> I guess.

I've never used PowerShell, but it seems like the right idea - passing
objects instead of text around. Eliminates a lot of the hairy issues
when you have to escape things multiple times, have special characters
in filenames, etc. Lua tables are a type of object as well, very well
suited for this. It's the in-bounds/out-of-bounds signalling issue,
basically - a filename should be contained in something (e.g. an
individual string) marked "this is a filename"; it shouldn't be mixed
in with parameters and commands where it can easily be mistaken for
one of them.

Like I said though, you'd still have a bash-like shell for simple
command invocation. It's just when you get to "programming" in bash,
you'd be much better using an actual programming language, than to try
to hack together shell scripts that will break as soon as they
encounter an oddly-named file.

-- 
Sent from my toaster.