Skip to main content

Module test

Module test 

Source
Expand description

This is test(1), not a testing mod.

We use stricter syntax here and it’s not POSIX- or fish-compatible. Specifically,

  1. Unary primitives always consume the next argument which must be present. They also cannot take a compound expression as argument.
  2. Cannot use bare strings as booleans, -z or -n must be used.
  3. !, (, ) and strings starting with - are forbidden in binary operations.
; Expr must not contains "]" in either form.
FullArgs := "test" Expr
          | "[" Expr "]"

BoolExpr := ["-f" | "-z" | ..] STR
          | STR_NOT_OP_LIKE ["-ne" | "-lt" | ..] STR_NOT_OP_LIKE
          | "(" Expr ")"
NotExpr  := BoolExpr
          | "!" NotExpr
AndExpr  := NotExpr
          | NotExpr "-a" AndExpr
OrExpr   := AndExpr
          | AndExpr "-o" OrExpr
Expr     := OrExpr

Functions§

test