xset
ARES System Manual: xset Utility

xset <variable> <command>: runs <command> and stores the output in the specified environment variable, with a brief timeout in case the job is silent
xset -q <variable> <command>: as above, but stops immediately once the job ends, even if no output has been received
xset -t <variable> <command>: as above, but forces xset to wait until some output has been received
xset -s <variable> <program>: stores synopsis information for <program> in the specified environment variable
xset <variable> = <database.entry>: put contents of LSD:<database.entry> into the specified environment variable
xset <variable> = %keys <database.entry>: put keys of LSD:<database.entry> into the specified environment variable, concatenated with spaces
xset <variable> = %values <database.entry>: put values of LSD:<database.entry> into the specified environment variable, concatenated with linebreaks

xset is a standalone program that redirects the output pipe from another command into an environment variable for later manipulation in a shell script.

Environment variables are stored in the database section (JSON-formatted LinksetData entry) env.

This command is required for version comparison in many .pkg installer scripts, and is included with all versions of ARES.

By default, xset closes its pipe after receiving both the job termination receipt and at least one pipe message. This is necessary because sending output is slower than sending the termination message.

The -q switch will usually cause xset to terminate the pipe before output is received, but allows for greater compatibility with UNIX-style 'silent default' programs if they are slow to exit. If not specified, xset will wait 300 ms after receiving the DONE signal to ensure pipes are flushed, as DONE has a shorter round-trip time than the NOTIFY for text I/O.

Messages sent to non-extant pipes are redirected via chat channel 0 (as though the pipe's unique identifier was that of an avatar) by the io daemon, which usually means they are unrecoverable.

xset is intended for use with short messages, typically no more than one buffer in length. Jobs that yield multiple print() statements may have the last truncated unless they wait before resolving.

The special syntaxes with = bypass normal functionality and allow for easy retrieval of values from the database.

Reminder: environment variables are stored in Linkset Data (LSD) just like other db entries. They can be perused with @db env. When writing scripts, remember to clean up your variables at the end!