diff --git a/tsshbatch.rst b/tsshbatch.rst index 8b69006..a744718 100644 --- a/tsshbatch.rst +++ b/tsshbatch.rst @@ -595,9 +595,9 @@ 10) Defining Variables ``tsshbatch`` allows you to define variables which will then be - used to replace matching strings in both ``cmdfiles`` and - ``hostlistfiles``. For example, suppose you have this in a - ``hostlistfile``:: + used to replace matching strings in ``cmdfiles``, + ``hostlistfiles``, and file transfer specifications. For example, + suppose you have this in a ``hostlistfile``:: .define DOMAIN=.my.own.domain.com @@ -625,7 +625,7 @@ with nothing, effectively removing them. Any ``=`` symbols to the right of the one right after ``name`` - are just considered part of the variables value. + are just considered part of the variable's value. Whitespace around the ``=`` symbol is optional but allowed. @@ -679,7 +679,7 @@ You can do this in commands (and commands within command files) as well:: - tsshbatch -x hosts 'echo I am running on __HOSTNAME__' + tsshbatch.py -x hosts 'echo I am running on __HOSTNAME__' Be careful to escape and quote things properly, especially from the the command line, since ``<`` and ``>`` are recognized by the shell @@ -700,6 +700,26 @@ figure this stuff out. It just manipulates the strings you provide as hostnames. + The symbols ``__HOSTNAME__`` and ``__HOSTSHORT__`` are like any other + symbol you might have specified yourself with ``.define``. *This means + you can override their meaning*. For instance, say you're doing this:: + + tsshbatch.py -x myhosts echo "It is: __HOSTNAME__" + + As you would expect, the program will log into that host, echo the + hostname and exit. But suppose you don't want it to echo something + else for whatever reason. You'd create a command file with this + entry:: + + __HOSTNAME__ = Really A Different Name + + Now, when you run the command above, the output is:: + + It is: Really A Different Name + + In other words, ``.define`` has a *higher precedence* than + the preconfigured values of ``HOSTNAME`` and ``HOSTSHORT``. + OTHER ----- @@ -798,7 +818,7 @@ :: - $Id: tsshbatch.rst,v 1.141 2014/12/02 20:19:35 tundra Exp $ + $Id: tsshbatch.rst,v 1.142 2014/12/02 21:04:10 tundra Exp $ You can find the latest version of this program at: