A pipeline is a series of one or more commands delimited by pipe sign (‘|’). Each command is either an argument or a function call, in form:
func arg1 arg2...
where func is the name of one of the built-in functions discussed below.
Pipelines are executed from left to right, with the result of the previous command implicitly added to the list of arguments of each subsequent command. For example, the pipeline
.attr | eq $x
is equivalent to
eq $x .attr
i.e. it calls the built-in function eq
with two arguments: the
value of the variable ‘x’ and attribute ‘attr’ of the cursor
value.
The following built-in functions are defined:
Evaluates to true
if pipelines A1 and A2 both
evaluate to true
. Notice, that there is no boolean shortcut
evaluation: both pipelines are evaluated prior to calling and
.
Evaluates to true
if at least one of the pipelines A1 and
A2 evaluates to true
. Notice, that there is no boolean
shortcut evaluation: both pipelines are evaluated prior to calling or
.
Returns the result of indexing its first argument by the following arguments. Thus, if ‘.’ is an array, then:
index . 5
evaluates to its fifth element (‘.[5]’).
Returns the integer length of its argument.
Returns true
if its argument evaluates to false
.
Returns true
if both its arguments are equal. This applies only
if both A1 and A2 are numeric or if they both are strings.
Returns true
if its arguments (both must be numeric or strings)
are not equal.
Returns true
if A1 is numerically less than A2.
Returns true
if A1 is numerically less than or equal to A2.
Returns true
if A1 is numerically greater than A2.
Returns true
if A1 is numerically greater than or equal
to A2.
Returns true
if A1, which must evaluate to an integer
value, is divisible by 2.
Implements the printf
function. FMT must evaluate to
string. Rest of arguments is interpreted according to the conversion
specifications in FMT. The result is a formatted string.
In addition to the standard conversion specifications, the ‘%v’ specifier is implemented: it formats its argument in the best way, depending on its actual type.
Evaluates to the type of its argument, one of:
null
, bool
, number
, integer
, string
,
array
, and object
.
A1 must evaluate to an object and A2 to string. The
function evaluates to true
if the attribute A2 is present
in A1.
Returns the sum of its arguments.
Returns the difference A1 - A2
.
Multiplies A1 by A2.
Divides A1 by A2.