Skip to content

The Biggest Shell Programs in the World

andychu edited this page Mar 25, 2020 · 16 revisions

Help me fill out this page! It's freely editable.

What programs should be listed? I'm using "biggest" in the sense of substantial, not necessarily the raw number of lines.

  • Hand-written shell scripts. There are many big autoconf-generated scripts, like the 70K-line coreutils script, but I don't consider them substantial in this sense.
  • Shell programs that use data structures and algorithms.
    • As a counterexample, bash-completion is pretty sophisticated, but it's also repetitive because it has a relatively simple function for every command on a Unix machine.
  • Shell programs that are over 5K lines (though there may be exceptions). The biggest shell programs that aren't repetitive tend to be in the 10K+ line range. I haven't seen any programs over 100K lines.

The List

  • akinomyoga/ble.sh -- Bash Line Editor. fish-like interactive line editor in pure bash! out/ble.sh is 21K lines of code but it looks like there is 30K+ lines of code in the repo. There are many comments (in Japanese).
    • How Interactive Shells Work has a nice overview of how ble.sh works. It's very sophisticated, using bind -x to read raw bytes from the terminal, decoding those itself in mulitiple explicit state machines, maintaining a drawing buffer, updating the buffer, etc. It has timing and "fibers", etc.
    • This comment on issue 663 has details on the shell parser! I think this is one of the most sophisticated uses of data structures in shell I've seen.
    • We are trying to run ble.sh under Oil. It mostly parses.
    • First commit in 2015
  • drwetter/testssl.sh -- 21K lines of bash in a single file! Appears to be hand-written. History: Back in 2006 it started with a few openssl commands.... (Hit issue #606 parsing it.)
  • dylanaraps/neofetch -- 10K lines of bash 3.2. Displays system information. May also do something interesting with images (?)
    • first commit 2015

Languages / DSLs

  • modernish is a portable shell dialect written in shell
  • bats is a DSL for writing tests. Generates bash code.
  • bashible is an Ansible-like DSL in bash. comments
  • clash is an object oriented framework compatible with any modern POSIX shell.
  • bash Infinity is a standard library and a boilerplate framework for bash.

Smaller Programs

  • Alpine, Aboriginal, Debian scripts -- see blog post
  • Completion scripts are big, but often repetitive.
    • git-completion.bash
    • Docker completion
  • dyne/Tomb is a ~3500 line zsh script.

Links

Clone this wiki locally
You can’t perform that action at this time.