'TeamCity build number override from script

I have a problem with setting up the build number for the build from the script. I use the shell command in TeamCity build step:

   echo "##teamcity[buildNumber '%build.counter%.%tp.environment%.%tp.environment.contentSpreadsheetSelectOverride%']"

And it results in build number:

\''868.car_hdev.Dev'\' 

When I perform the test:

echo '%build.counter%.%tp.environment%.%tp.environment.contentSpreadsheetSelectOverride%'

It gives me the right output:

868.car_hdev.Dev

I believe I do everything as instructed here: https://www.jetbrains.com/help/teamcity/service-messages.html#Reporting+Build+Number

Do you have any idea why there are additional characters in the resulting build number?



Solution 1:[1]

Turns out I had to change:

#!/bin/sh -x

To:

#!/bin/bash

In the build step script.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Emilia Tyl