Websphere Jacl-在选项说明符中使用变量的正确语法是什么

Websphere Jacl-在选项说明符中使用变量的正确语法是什么,websphere,websphere-8,wsadmin,jacl,Websphere,Websphere 8,Wsadmin,Jacl,尝试在Jacl脚本中运行以下命令时(在此调用之前已设置$APPNAME): 我得到以下错误 WASX7017E: Exception received while running file "deploy_myk.jacl"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7108E: Invalid data specified for install task: "AppDeploymentOption

尝试在Jacl脚本中运行以下命令时(在此调用之前已设置$APPNAME):

我得到以下错误

WASX7017E: Exception received while running file "deploy_myk.jacl"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7108E: Invalid data specified for install task: "AppDeploymentOptions."  
Errors are: 
"ADMA0085E: A validation error occurred in task Specifying application options. Application name, $APPNAME, is not valid.
 An application name cannot begin with a dot, cannot have leading or trailing spaces, cannot contain "]]>", and cannot contain any of the following characters:  \ / , # $ @ : ; " * ? < > | = + & % '"
WASX7017E:运行文件“deploy_myk.jacl”时收到异常;异常信息:com.ibm.ws.scripting.ScriptingException:WASX7108E:为安装任务“AppDeploymentOptions”指定的数据无效
错误包括:
ADMA0085E:指定应用程序选项的任务中发生验证错误。应用程序名称$APPNAME无效。
应用程序名称不能以点开头,不能有前导空格或尾随空格,不能包含“]]>”,也不能包含以下任何字符:\/、\$@:;“*?<>\=+&%”"

我似乎找不到在“选项”说明符字符串中说明脚本变量使用的文档。显然,一定有某种方法可以完成我正在尝试做的事情,那就是部署一个EAR文件,该文件的名称由我在脚本运行时选择。

在使用变量之前必须设置它。因为您没有包括我想这就是我所缺少的。在你的脚本中,你应该可以从以下内容开始:

# Set $APPNAME to be the first argument to this script.
set APPNAME [lindex $argv 0]
$AdminApp install $EARFILE "-nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ..."

然后从那里开始。然后您可以使用应用程序名作为第一个参数运行jacl脚本。

jacl/Tcl是一种基于字符串的语言,
{}
分隔符可以防止变量插值,类似于UNIX shell编程中的
'
。您想要的是:

# Set $APPNAME to be the first argument to this script.
set APPNAME [lindex $argv 0]
$AdminApp install $EARFILE "-nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ..."
…或:

$AdminApp install $EARFILE [list -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -verbose -appname $APPNAME -createMBeansForResources -noreloadEnabled ...]
这可能会引起兴趣,特别是“评估和替换”部分


或者,您可以通过切换到
-lang jython

来避免Jacl字符串的复杂性。感谢您花时间提供帮助。我澄清了问题描述。