A shell parser, formatter, and interpreter. Supports POSIX Shell, Bash, and mksh. Requires Go 1.16 or later. To parse shell scripts, inspect them, and print them out, see the syntax examples. For high-level operations like performing shell expansions on strings, see the shell examples. shfmt formats shell programs. See canonical.sh for a quick look at its default style. shfmt formats shell programs. If the only argument is a dash (-) or no arguments are given, standard input will be used. If a given path is a directory, all shell scripts found under that directory will be used. When indexing Bash associative arrays, always use quotes. The static parser will otherwise have to assume that the index is an arithmetic expression. Some builtins like export and let are parsed as keywords. A subset of the Go packages are available as an npm package called mvdan-sh.

Features

  • Parse shell scripts
  • High-level operations like performing shell expansions
  • shfmt formats shell programs
  • Packages are available on Alpine, Arch, Debian, Docker, FreeBSD, etc.
  • We use Go's native fuzzing support
  • Requires Go 1.18 or later
  • Some builtins like export and let are parsed as keywords

Project Samples

Project Activity

See All Activity >

License

BSD License

Follow sh

sh Web Site

Other Useful Business Software
Forever Free Full-Stack Observability | Grafana Cloud Icon
Forever Free Full-Stack Observability | Grafana Cloud

Our generous forever free tier includes the full platform, including the AI Assistant, for 3 users with 10k metrics, 50GB logs, and 50GB traces.

Built on open standards like Prometheus and OpenTelemetry, Grafana Cloud includes Kubernetes Monitoring, Application Observability, Incident Response, plus the AI-powered Grafana Assistant. Get started with our generous free tier today.
Create free account
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of sh!

Additional Project Details

Programming Language

Go

Related Categories

Go Terminals, Go User Interface (UI) Software

Registered

2022-04-11