Previous: Invoking gpg-connect-agent, Up: gpg-connect-agent [Contents][Index]
While reading Assuan commands, gpg-agent also allows a few special
commands to control its operation. These control commands all start
with a slash (/).
/echo argsJust print args.
/let name valueSet the variable name to value. Variables are only
substituted on the input if the /subst has been used.
Variables are referenced by prefixing the name with a dollar sign and
optionally include the name in curly braces. The rules for a valid name
are identically to those of the standard bourne shell. This is not yet
enforced but may be in the future. When used with curly braces no
leading or trailing white space is allowed.
If a variable is not found, it is searched in the environment and if found copied to the table of variables.
Variable functions are available: The name of the function must be followed by at least one space and the at least one argument. The following functions are available:
getReturn a value described by the argument. Available arguments are:
cwdThe current working directory.
homedirThe gnupg homedir.
sysconfdirGnuPG’s system configuration directory.
bindirGnuPG’s binary directory.
libdirGnuPG’s library directory.
libexecdirGnuPG’s library directory for executable files.
datadirGnuPG’s data directory.
serverpidThe PID of the current server. Command /serverpid must
have been given to return a useful value.
unescape argsRemove C-style escapes from args. Note that \0 and
\x00 terminate the returned string implicitly. The string to be
converted are the entire arguments right behind the delimiting space of
the function name.
unpercent argsunpercent+ argsRemove percent style escaping from args. Note that %00
terminates the string implicitly. The string to be converted are the
entire arguments right behind the delimiting space of the function
name. unpercent+ also maps plus signs to a spaces.
percent argspercent+ argsEscape the args using percent style escaping. Tabs, formfeeds,
linefeeds, carriage returns and colons are escaped. percent+ also
maps spaces to plus signs.
errcode argerrsource argerrstring argAssume arg is an integer and evaluate it using strtol. Return
the gpg-error error code, error source or a formatted string with the
error code and error source.
+-*/%Evaluate all arguments as long integers using strtol and apply
this operator. A division by zero yields an empty string.
!|&Evaluate all arguments as long integers using strtol and apply
the logical operators NOT, OR or AND. The NOT operator works on the
last argument only.
/definq name varUse content of the variable var for inquiries with name.
name may be an asterisk (*) to match any inquiry.
/definqfile name fileUse content of file for inquiries with name.
name may be an asterisk (*) to match any inquiry.
/definqprog name progRun prog for inquiries matching name and pass the entire line to it as command line arguments.
/datafile nameWrite all data lines from the server to the file name. The file is opened for writing and created if it does not exists. An existing file is first truncated to 0. The data written to the file fully decoded. Using a single dash for name writes to stdout. The file is kept open until a new file is set using this command or this command is used without an argument.
/showdefPrint all definitions
/cleardefDelete all definitions
/sendfd file modeOpen file in mode (which needs to be a valid fopen
mode string) and send the file descriptor to the server. This is
usually followed by a command like INPUT FD to set the
input source for other commands.
/recvfdNot yet implemented.
/open var file [mode]Open file and assign the file descriptor to var. Warning: This command is experimental and might change in future versions.
/close fdClose the file descriptor fd. Warning: This command is experimental and might change in future versions.
/showopenShow a list of open files.
/serverpidSend the Assuan command GETINFO pid to the server and store
the returned PID for internal purposes.
/sleepSleep for a second.
/hex/nohexSame as the command line option --hex.
/decode/nodecodeSame as the command line option --decode.
/subst/nosubstEnable and disable variable substitution. It defaults to disabled unless the command line option --subst has been used. If /subst as been enabled once, leading whitespace is removed from input lines which makes scripts easier to read.
/while condition/endThese commands provide a way for executing loops. All lines between
the while and the corresponding end are executed as long
as the evaluation of condition yields a non-zero value or is the
string true or yes. The evaluation is done by passing
condition to the strtol function. Example:
/subst
/let i 3
/while $i
/echo loop counter is $i
/let i ${- $i 1}
/end
/if condition/endThese commands provide a way for conditional execution. All lines between
the if and the corresponding end are executed only if
the evaluation of condition yields a non-zero value or is the
string true or yes. The evaluation is done by passing
condition to the strtol function.
/run fileRun commands from file.
/history --clearClear the command history.
/byeTerminate the connection and the program.
/helpPrint a list of available control commands.
Previous: Invoking gpg-connect-agent, Up: gpg-connect-agent [Contents][Index]