lua-users home
lua-l archive

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


You can try luabash[1] wish is a bash modulue to interact with lua.
Its possible to use lua in bash (even the interative prompt) and load
bash script within lua. I use it at work to extend bash scripts.

For your example create a lua file;
--Lua scipt
function redirections()
      if a~=nil then print("xx"..a.."xx") end
   until a==nil
-- We need to register the function

# Now from bash
# Enable the bash module
enable -f
# Load the lua scrpit
luabash load ./script.lua

cat <<EOF | redirections | sed 's,xx,yy,g' # here is the redirictions function being called
line one
line two
line three
# Done
You can use"sed /thing/thang( file.txt)") from lua.

Check the examples [2] 
I can write more documentation if you want.


Alfredo Palhares