#shell #lua-script #bash

app lush

LuSH is a lua for shell scripts - embedded in a single binary, easy to share, to run everywhere

9 releases

0.1.8 Oct 18, 2024
0.1.7 Oct 6, 2024
0.1.6 Aug 27, 2024
0.1.4 Jul 23, 2024

#942 in Development tools

Apache-2.0

32KB
506 lines

LuSH

LuSH is a lua for shell scripts - embedded in a single binary, easy to share, to run everywhere

The problem

I love Bash. I have tons of bash scripts, they're run only on my machine. If I copy to other hosts, they never work properly because either the bash version is older or some of the shell utils are not available or are not the same version, etc. Surely there are many methods to solve this, but the scripts complexity just increase. In prative, they never work everywhere.

I want to simplify my life, not the other way around.

The solution

My own solution for that is to be able to deploy, just by copying, all I need to run my scripts. My first idea was to build a portable bash version, but I still need to have many other utils, such as awk, cut, wc, etc. So, why not using a more powerful language? For that, one widely used, easy and that just works is LUA. I love its simplicity and powerful tables.

Initially, where I am, this will be a portable LUA interpreter (without any dependencies, all static) and many lua scripts with helpers to make it easy for the scripts to call local binaries.

Why nots

Why not Python?

Because I really don't like whitespace as block delimiter

Why not Ruby?

Because the runtime is big and not very portable.

Why not (whatever other language)?

Because I had to choose one. I got a super popular language as I don't want to be the eternal father of the project. I want something to solve my issues and not creating more. LUA has tons of scripts to do pretty much anything and most of them I just need to copy a lua file to a directory. Isn't it great?

Installing

Run the script

cargo install lush

Documentation of LuSH extensions

Please refer to the doc directory of this repository. Each module has its own file

Dependencies

~11–21MB
~306K SLoC