The variable BUILDNUMBER is set to value 230. I expect 230_ to be printed for the command echo $BUILDNUMBER_ but the output is empty as shown below.# echo $BUILDNUMBER_# echo $BUILDNUMBER230
Bash variable substitution of variable followed by underscore
bash;shell script;variable substitution
The command echo $BUILDNUMBER_ is going to print the value of variable $BUILDNUMBER_ which is not set (underscore is a valid character for a variable name as explicitly noted by Jeff Schaller)You just need to apply brackets around the variable name or use the most rigid printf tool:echo ${BUILDNUMBER}_printf '%s_\n' $BUILDNUMBERPS: Always quote your variables.