Powscript

raw JSON →
1.1.2 verified Fri May 01 auth: no javascript deprecated

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.

error bash: powscript: command not found
cause Powscript not installed in PATH or not executable.
fix
Download and make executable: wget -O /usr/local/bin/powscript https://raw.githubusercontent.com/coderofsalvation/powscript/master/powscript && chmod +x /usr/local/bin/powscript
error ./powscript: line 1: syntax error near unexpected token `newline'
cause The powscript file was not downloaded correctly (e.g., missing shebang).
fix
Re-download the raw script from GitHub using wget or curl.
error require_cmd: echo: command not found
cause The required command is not installed on the system.
fix
Install the missing command (e.g., via apt-get, yum) or remove the require_cmd line.
gotcha Powscript requires bash >= 4.x. Running on older bash versions will cause errors.
fix Upgrade bash to version 4 or later, or use a different shell.
breaking The new compiler (beta) is not backward compatible; scripts written for the old compiler may not work.
fix Check the beta compiler repository for migration notes.
deprecated Project is in maintenance mode with no active development. The README points to a beta version by another author.
fix Consider alternatives like shellcheck, bashate, or writing bash directly if future support is needed.
gotcha POSIX sh output (--sh flag) is experimental and may contain bashisms if the powscript uses bash-specific features.
fix Manually verify output with checkbashisms or stick to bash output.
npm install powscript
yarn add powscript
pnpm add powscript

Install powscript, create a simple script with argument handling, run it directly, and compile to bash.

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