IBM Support

Substituting variables in wsadmin

Troubleshooting


Problem

Variable in the braces are considered as a string.

Cause

Passing the variable in the braces will be considered as a string. For example, $KerberosConfFileName and other variables in the following example will be considered as string and will not be substituted by the actual value.


$AdminTask createKrbConfigFile {-krbPath $KerberosConfFileName -realm $KerberosRealm -kdcHost $KDCHost -dns $DNS -keytabPath $KeytabPath }

All the variables inside the braces will be considered as string and will not substitute the actual value of the variable.

Resolving The Problem

In the above example the variable is used inside the braces {}. In Jacl , braces { } will group the contents and parse it as a SINGLE string, so it will not attempt to resolve the variables in it.

In order to resolve the variable in the above command, either "subst" or "list" command should be used.
"subst" will resolve the variables in the string and "list" will resolve the variables and group the contents as a single string.

Here are the modified samples.

Using subst
$AdminTask createKrbConfigFile [subst {-krbPath $KerberosConfFileName -realm $KerberosRealm -kdcHost $KDCHost -dns $DNS -keytabPath $KeytabPath }]

Using list
$AdminTask createKrbConfigFile [list -krbPath $KerberosConfFileName -realm $KerberosRealm -kdcHost $KDCHost -dns $DNS -keytabPath $KeytabPath]

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Administrative Scripting Tools (for example: wsadmin or ANT)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;6.1;6.0;5.1","Edition":"Base;Enterprise;Network Deployment"},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":""}]

Historical Number

72447;057;649

Document Information

Modified date:
15 June 2018

UID

swg21254555