Bash坏变量替换

时间:2015-02-20 22:03:13

标签: bash shell

我有一个安装脚本,修改了大约一个月的agao,它几乎每次都工作,除了'occssional'失败。在调查问题后,我尝试手动运行脚本(bash -x),并在以下行发现错误的变量替换错误

local HTTPD=${$APACHE_ADDRESS}

我将此更改为

local HTTPD=${APACHE_ADDRESS}

..并且脚本每次都手动运行并安装成功。 $ {APACHE_ADDRESS}变量来自属性文件。我的问题是这种替代怎么可能在95%的时间内发挥作用!?

OS= RHEL 6.6

添加上下文....它作为流动场景的一部分执行

batch_config ()
{
does_file_exist ${BATCH_CONFIG}
        # need to get the Datastore 'type'
        local DATASTORE_NAME="OpenDJ"
        local AUTHSERVICE_NAME="ldapService"
        local HTTPDFQDN=${APACHE_SERVER}
        local idmgrName="identity-mgr-service"

        ${CAT} << EOF > ${SSO_BATCH_CONFIG}
create-realm -e ${REALM_NAME}
create-policies -e / -X ${REFERRAL_TEMP_FILE}
create-policies -e /${REALM_NAME} -X ${POLICY_TEMP_FILE}
create-agent -e /${REALM_NAME} -b ${AGENT_NAME} -t WebAgent -s ${BACKEND_SERVER_URL}/${DEPLOYMENT_NAME} -g ${AGENT_SERVER_URL} -a "userpassword=` ${CAT} ${AGENT_ACCESS_FILE} `"
update-agent -e /${REALM_NAME} -b ${AGENT_NAME} -D ${AGENT_ATTRIBUTES_FILE}
create-agent -e / -b idmgr -t J2EEAgent -a userpassword=xxxxxxx -g http://${HTTPDFQDN}:8085/agentapp -s http://myalias.${HTTPDFQDN}:4448/mywar
----
----

0 个答案:

没有答案