next up previous contents index
Next: I/O Redirection Up: Quoting Previous: Single-Character Quoting   Contents   Index

Back-Quoting, Command Evaluation

A string enclosed by backquotes (`) is considered a command and is executed, and the output of the command replaces the text.

In releases 4.1.7 and earlier, the command was simply sent to the operating system, and evaluated by whatever shell is supervising the user's login. In release 4.1.8 and later, back-quoted text is evaluated by the WRspice shell itself, unless the text begins with the keyword ``shell'' in which case the rest of it is sent to the operating system for evaluation.

The new approach makes it possible to get the output of internal WRspice commands and functions into strings, which was not easy (or even possible?) before. However, this may require updating legacy scripts. For example, lines like

set datestring="`date`"
must be changed to
set datestring="`shell date`"

Stephen R. Whiteley 2022-09-18