-1

I have a pipeline variable called DeployPath

with bash script as a straight method I will be able to display the value of DeployPath using

echo $(DeployPath)

so if the name of the variable is dynamic is their any way i will be able to access the variable value from Bash

eg

$var=DeployPath
echo $($var) // something like this it should display the value Corresponding to DeployPath

I am unable to find a solution for this..

  • You have the option to create dynamic variables using `##vso[task.setvariable variable=Token]value"` . You can then use this dynamic variable that you created on a previous task with `$(Token)` syntax. If you need to access this variable on a different job you will have to use also `isOutput` – GeralexGR May 31 '22 at 12:48

1 Answers1

1

After a lot of trial and error I figure out a perfect solution.

All the pipeline variables are accessible through environment variables so the only thing we need to do is to make the make the variable uppercase as the environment variables are stored in uppercases

the solution is given below:

$var=DeployPath
upper= ${var^^}
echo ${!upper}