SH-SEXPRS(1)SH-SEXPRS(1)NAME
sexprs, islist, els, text, textels, mktext, mklist, mktextlist - parse
and generate S-expressions
SYNOPSIS
load sexprs
getsexprs command
islist sexpr
${els sexpr}
${text sexpr}
${textels sexpr}
${mktext val}
${mklist [ val... ]}
${mktextlist [ val... ]}
DESCRIPTION
Sexprs is a loadable module for sh(1) that provides the facility to
parse and generate S-expressions (see sexprs(2)). The following primi‐
tives are provided:
getsexprs Getsexprs works similiarly to getlines in sh-std(1). It
reads S-expressions from the standard input, and for expres‐
sion read, it invokes command with $sexp set to the text rep‐
resentation of that expression. Getsexprs recognises the
usual loop break and continue exceptions.
islist sexp
Islist yields a nil (true) status if sexp, which must be a
well-formed S-expression, is a list element.
${els sexp}
If sexp is an S-expression containing a list, then els
returns a list of the S-expressions it contains. It is an
error if sexp is not a valid S-expression.
${text sexp}
If sexp is an S-expression containing a simple element, then
text returns the value of that element. If sexp is a list,
the return value will be an empty string. Note that elements
containing binary data will likely be corrupted by conversion
to utf-8. It is an error if sexp is not a valid S-expres‐
sion.
${textels sexp}
If sexp is an S-expression containing a list, then textels
returns a list of the text values in that S-expression, con‐
verted as with ${text}. It is an error if sexp is not a
valid S-expression.
${mktext val}
Mktext returns a text representation of the S-expression con‐
taining the simple value val.
${mklist [sexp...]}
Mklist returns a text representation of the S-expression list
containing its arguments, which must be well-format S-expres‐
sions.
${mktextlist [val...]}
Mktextlist returns a text representation of the S-expression
list containing one simple element for each val.
SOURCE
/appl/cmd/sh/sexprs.b
SEE ALSOsh(1), sh-std(1), sexprs(2)SH-SEXPRS(1)