Powscript
raw JSON →Powscript is a bash dialect transpiler written in bash that provides a CoffeeScript-inspired, indentation-based syntax for shell scripting. It compiles to bash (version 4+) or experimental POSIX sh, reducing semantic noise from traditional shell syntax. Features include automatic quoting, safety checks (halt on error, require_cmd/require_env), functional programming constructs, JSON support, module system, and easy async. The current stable version is 0.9 (based on old compiler), with a new compiler in development (beta available). It is self-installing with no external dependencies (bash-only) and targets embedded systems or any environment where bash is available. Key differentiator: no need for gcc or node – pure bash, but not actively maintained.
Common errors
error bash: powscript: command not found ↓
error ./powscript: line 1: syntax error near unexpected token `newline' ↓
error require_cmd: echo: command not found ↓
Warnings
gotcha Powscript requires bash >= 4.x. Running on older bash versions will cause errors. ↓
breaking The new compiler (beta) is not backward compatible; scripts written for the old compiler may not work. ↓
deprecated Project is in maintenance mode with no active development. The README points to a beta version by another author. ↓
gotcha POSIX sh output (--sh flag) is experimental and may contain bashisms if the powscript uses bash-specific features. ↓
Install
npm install powscript yarn add powscript pnpm add powscript Imports
- powscript wrong
npm install powscriptcorrect./powscript myscript.pow - compile wrong
./powscript -o output bash myscript.powcorrect./powscript -c myscript.pow > myscript.bash - run wrong
bash myscript.powcorrect./powscript myscript.pow
Quickstart
wget "https://raw.githubusercontent.com/coderofsalvation/powscript/master/powscript" -O /usr/local/bin/powscript && chmod 755 /usr/local/bin/powscript
# Create a test.pow file:
cat > test.pow << 'EOF'
#!/usr/bin/env powscript
require_cmd 'echo'
require_env 'HOME'
run(@args -- foo)
if empty? foo
echo "error: please pass --foo <string>"
exit 1
echo $args[@] "$foo universe!!"
echo "HOME=$HOME"
run $@
EOF
# Run it:
powscript test.pow hello --foo powful
# Or compile to bash:
powscript -c test.pow > test.bash