Skip to content

Command vs Expression Mode

andychu edited this page Jul 9, 2021 · 7 revisions

Oil: http://www.oilshell.org/release/latest/doc/command-vs-expression-mode.html

elvish: Prefix syntax for arithmetic. So there's only one mode? Code can get lispy because () is command substitution.

Oh Syntax Comparison

The shell language for single commands is almost identical, but the rest is homoiconic syntax? There is a math command for infix, e.g. math '1.2 + 3.4'.

NGS Manual

Switching between syntaxes

In command syntax it is possible to switch to code syntax in one of the following ways:

  • Simple switching (for a lack of better name)
  • Single argument substitution switch
  • Multiple arguments substitution switch

In code syntax it is possible to switch to command syntax in one of the following ways:

  • Capture switch
  • Capture and parse switch
  • Command switch

Mash Shell Quick Reference

Mish is a sublanguage within Mash for launching processes, with a similar syntax to a traditional shell.

By default, Mash is in "regular Mash" mode. If a command line starts or ends with !, the entire line is interpreted as a Mish command. If ! is issued by itself as a command, then Mash toggles into Mish by default, and the prompt changes from a $ to a !.

Neugram Shell (Go-based, implemented in Go)

A $$ ... $$ expression in Neugram is a sequence of shell commands. If used as a top-level statement in the interpreter, commands are executed as they are parsed. Otherwise, shell commands are executed when the $$-expression is evaluated according to standard Neugram rules.

Clone this wiki locally