home / software

Luashell


Status

20080407 - beta snapshots of luashell.lua are available.

Download

Download ztact-lua.zip
View luashell.lua

Overview

The luashell.lua module facilitates writing shell scripts in Lua. luashell.lua requires pozix.c and ztact.lua.

An example Luashell script:



-- public domain 20080410 lua@ztact.com


require 'luashell'
luashell.setfenv ()    -- magically create functions from $PATH


do

  local foo='bar'

          -- echo is a builtin function
          -- note that environment and local variables can be accessed via $
  echo 'local variable foo is $foo'
  echo 'PATH is $PATH'

  cd '$HOME'    -- cd is also a builtin function

          -- the ls function is dynamically created when called
	  -- the ls function will fork and exec /bin/ls
  ls ()
  ls '-la --sort=size'
  ls ('-la', '--sort=size')

          -- similarly, any non-existent function that matches a program
	  -- in $PATH will also be magically created when called
  tar '--help'
  end

Advantages of Luashell over other shell scripting languages

To do / currently unimplemented