Variable Substitution in WSAdmin: Variables in braces are treated as constants

Just a quick FYI to those of you who are doomed to write WSAdmin scripts, if you use variable names and enclose them in curly braces ‘{‘, then commands will treat it as a constant string and your variables will not resolve to their values.

$AdminTask blah {-file $VariableFileName}

Will cause and error that the physical file “$VariableFileName” could not be found.

To resolve the issue use the subst or list command:

$AdminTask blah [subst {-file $VariableFileName}]

http://www-01.ibm.com/support/docview.wss?uid=swg21254555

Author: dan

Comments

  1. Dan, this is one reason I tend to write my wsadmin scripts in jython rather than Jacl… the syntax is less irritating. Jacl will also eventually be phased out, so it’s worth getting used to jython.

Leave a Reply

Your email address will not be published. Required fields are marked *