lumarsh 0.2.4

Use LUA for shell scripting

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:


Lumarsh is a small Lua script runner (powered by Lumars) with a small built-in library primarily for use with shell scripts.


Either compile it yourself with dub build -b release or fetch it from the latest release page.


curl -o lumarsh -L
chmod +x lumarsh
mv lumarsh /usr/local/bin

Using Lumarsh

There are two ways to use Lumarsh:

  • Execute a file lumarsh file_name
  • Execute a string lumarsh execute "print('henlo world!')"

Additionally any extra args are directly passed into the script via the LUMARSH_ARGS global variable:

for i,v in ipairs(LUMARSH_ARGS) do


While Lumarsh does support luarocks my aim is to not have to rely on it for most operations, so Lumarsh provides a decent set of libraries that are helpful for processing data.

An EmmyLua file is provided for editors with EmmyLua support, which serves as an overview of the API.

Lumarsh provides the following libraries:

  • sh.path - Exposes std.path into Lua.
  • sh.proc - Exposes std.process into Lua.
  • sh.fs - Exposes std.file into Lua.
  • sh.regex - Exposes std.regex into Lua.
  • sh.json - Exposes std.json into Lua.

Additionally, the following third party libraries are bundled with Lumarsh:

  • luafun - Provides high-performance functional programming
  • luafun is added into the global scope, so you can simply go range(0, 10, 2):each(print) easily.

I'm very willing to add more into lumarsh, so please tell me any suggestions you may have.

Luarocks support

If luarocks can be detected then lumarsh will set the LUA_PATH and LUA_CPATH variables to the output of luarocks path --lua-version 5.1.

Please note lumarsh only supports Lua 5.1 as that's the only version lumars supports

When installing packages, make sure to pass --lua-version 5.1 into luarocks, otherwise it might not be in the correct location.

If you're getting an error such as cannot find module luarocks.loader, then try the following command:

luarocks install luarocks --lua-version 5.1

Execution shorthand syntax

Instead of calling sh.proc.executeEnforceZero directly, you can instead use the sh:COMMAND(ARGS) shortcut:

print(sh.proc.executeEnforceZero("echo", {"This is what you'd normally do"}).output)
print(sh:echo("But instead, you can do this!").output)

Additionally, you can chain calls together to pass the output of one command into another's stdin:

-- Conventional way (If you don't specify `.output`, then the command's output is sent to stdin)
print(sh.proc.executeShell("grep", {"import", sh.proc.executeShell("cat", {"./source/api/execute.d"})}).output)

-- Easier way

Remember, call .output on a result object if you don't want it's data being sent to stdin!

-- Good
    sh:echo("This is my License: ", sh:cat("./").output).output

-- Bad
    sh:echo("This is my License: ", sh:cat("./")).output

Command echoing

By default lumarsh will echo the output of any command it runs.

To disable this, please set sh.echo to false.

  • Bradley Chatha
lumars, jcli
0.2.4 2021-Dec-12
0.2.4-pls-drone 2021-Dec-12
0.2.3 2021-Nov-28
0.2.2 2021-Nov-22
0.2.1 2021-Nov-22
Show all 17 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 21 downloads total

Short URL: