Next: , Previous: , Up: Top   [Contents][Index]


4 Command substitution

A construct

$(command)

is substituted with the output of the shell command command. Xenv performs substitution by running $SHELL -c command and replacing the construct with the standard output produced by the command, with any trailing newlines removed. If the SHELL variable is not set, ‘/bin/sh’ is assumed.

The command is passed to the shell verbatim. This means, in particular, that variable references in the command are expanded by the shell, rather than by xenv and, as a consequence, that the options -u, -r, and -e don’t affect command substitutions.

By default, xenv will wait for as long as it takes for the command to terminate. It is, however, possible to limit command execution time using the -t n option. If this option is given, the command is permitted to run no longer than n seconds. If it doesn’t terminate within that time, it will be forcibly terminated by sending it the SIGKILL signal, and a diagnostic message to that effect will be printed on standard error.

Command substitutions can be disabled using the --Wno-command command line option (see feature control).