Using Lua for shell script in Minix

145 views
Skip to first unread message

alby

unread,
Aug 19, 2011, 7:03:27 PM8/19/11
to minix3
Hi

I was just wondering, how would it be to use Lua (instead of bash,
etc) as the shell scripting language in Minix? (I only need to do
simple scripting, nothing advanced). Are there disadvantages? Would I
encounter problems?
Thanks




Jeff Pohlmeyer

unread,
Aug 19, 2011, 7:32:01 PM8/19/11
to min...@googlegroups.com

It would certainly be possible, but as far as being easy or even
desirable is a different story. One of the goals of Lua is to
provide a very minimal (and very portable) core. There is some
support for reading, writing, renaming, and removing files, but
other filesystem functions like stat() and mkdir() are missing.

There are many external modules available that can provide these
things (and a lot more). On other systems (e.g. Linux) they are
usually loaded at run-time via the "require" statement but this
approach isn't currently posible on Minix due to the lack of
shared library support. So any extra modules would need to be
compiled directly into the Lua executable. (I would recommend
at least including in the "posix" module, if you can get it to
compile on Minix.)

Another handy feature that is already included in the core Lua is
the popen() function that allows you to read the output from other
programs directly from Lua. This feature will work on Minix, but it
takes a few tweaks to the Lua makefile to enable it.


Regards,
- Jeff

alby

unread,
Aug 20, 2011, 7:36:25 AM8/20/11
to minix3
Thanks for the information, Jeff.
I was hoping to use Lua scripts to manipulate extended attributes
provided by some filesystems (which I will access through FUSE, once
its Minix implementation becomes available).
But now, from what you told me, I discovered that even creating a new
directory might be an obstacle, if I don't find/create the right Lua
extension! I am a bit disappointed.
Reply all
Reply to author
Forward
0 new messages