简体   繁体   中英

Use TeamCity environment variable in shell script

I have a TeamCity environment variable env.TIER_SUFFIX whose value is set as A . I want to be able to use this in my script build step where the script content is

    #!/bin/bash 
    tierSuffix=%env.TIER_SUFFIX%
    echo "TierSuffix is [${'$'}tierSuffix]"
    export ENV_TIER=%env.DEV_tierSuffix%

The build fails because export ENV_TIER=%env.DEV_tierSuffix% creates env.DEV_ and the build stops. Is there a way to use this in the export command so that it substitutes the value of %env.DEV_A% to ENV_TIER

The way I use TeamCity variables in bash scripts is:

buildCounter="%build.counter%"

where build.counter is TeamCity variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM