diff --git a/tsshbatch.rst b/tsshbatch.rst index 6979545..3e6334b 100644 --- a/tsshbatch.rst +++ b/tsshbatch.rst @@ -813,6 +813,38 @@ Execution Variables =================== +Execution Variables are actually a special case of User Defined +Variables. That is, they are evaluated at the same time and in the +same manner as any other User Defined Variable. The difference is +that a User Defined Variable describes a *literal string replacement*. +But an Execution Variable *runs a command, program, or script and +assigns the results to the variable*. + +For example, suppose you want create a file on many machines, and you +want that file to be named based on who ran the ``tsshbatch`` job. +You might do this in a ``cmdfile``:: + + .define __WHOAMI__ = ! whoami + touch __WHOAMI__-Put_This_Here.txt + +So, if ID ``luser`` is running ``tsshbatch``, a file called +``luser-Put_This_Here.txt`` will be created (or have its timestamp +updated) on every machine in the ``hostlistfile`` or named with +``-H``. + +Notice it is the ``!`` character is that distinguishes an Execution +Variable from a User Defined Variable. It is this character that +tells ``tsshbatch``, "Go run the command to the right of me and return +the results." The trailing space is optional and the definition could +be written as:: + + .define __WHOAMI__ = !whoami + +.. NOTE:: It's important to remember that the program you are invoking + *runs on the same machine as* ``tsshbatch`` *itself*, NOT each + host you are sending commands to. In other words, just + like Builtin Variables, Execution Variables are *locally + defined*. Builtin Variables @@ -1015,7 +1047,7 @@ :: - $Id: tsshbatch.rst,v 1.146 2014/12/04 22:03:42 tundra Exp $ + $Id: tsshbatch.rst,v 1.147 2014/12/04 22:26:37 tundra Exp $ You can find the latest version of this program at: