|
|
A local variable can be given a value for the duration of one command by prefixing the command with the variable assignment. For example:
var=2 var=1 for_info 'var=' $var for_info 'var=' $varwill first display the value of var as ``1'', and then as ``2''.
If the command is a function call, then the new value applies for the duration of the function call, after which the variable reverts to its previous value. It makes no difference whether or not the function also alters the value.