Crate oursh[][src]

Expand description

Documentation Build Status Dependencies Gitter Chat

This shell should be both POSIX compatible and yet modern and exciting. Fancy features should not be prevented by POSIX compatibility. This will effect the design of the shell.

The name of the shell is oursh which is both somewhat unique, and memorable. It’s also a nice name to play with pseudo-satirical themes… right comrade? It’s short (ish) and sneakily fits rs in it, which is the extension of Rust programs, the language this will be written in.

Features

  • POSIX compatibility
  • Shebang block programs
  • bash/zsh autocomplete compatibility
  • man / -h / --help parsing
  • Multi-line input
  • Modern scripting language
  • Obfuscated strings (!'password'!)
  • mosh like remote session support
  • Smart history, sync’d across devices
  • Pipe old commands without rerunning
  • Package manager
  • Sane defaults
  • Fast

Previous Work

I’ve been using fish as my main shell for a few years now. Fish inspires a lot of the modern syntax.

POSIX compatibility comes from my desire to use this shell as my chsh -s ... shell on Arch Linux. See the full POSIX reference for more information.

Some of the shebang language interoperation was inspired by my time with the Northeastern University PL group, and generally from writing Racket. The beauty of of merging the UNIX style #!... with Racket’s #lang ... here is very exciting to me. I might just have to make a {#lang ...} shortcut for Racket!

I’ve built and wrote a few things about shells before:

POSIX Reference

See the following sections for building the POSIX sh compliant program language, and interactive terminal based REPL. While this mainly defines the posix module, there are a lot of common concepts to all shells here.

  • 3§2 Shell Command Language
    • 10.2 Shell Grammar Rules
  • 2§2.5 Standard I/O Streams
  • 3§1.6 Built-In Utilities
  • 3§1.4 Utility Description Defaults
  • 2§2.3 Error Numbers
  • 1§11 General Terminal Interface
  • 2§2.4 Signal Concepts

Modules

Subprocess execution management.

Parsing and handling program syntax(es) of the shell.

Quick and effective raw mode repl library for ANSI terminals.

Macros

Print debug information to stderr.