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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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