# Unable to use buildkite-agent meta data

**URL:** <https://forum.buildkite.community/t/unable-to-use-buildkite-agent-meta-data/3954>\
**Category:** Pipelines\
**Created:** [October 10, 2024, 4:48am UTC](https://forum.buildkite.community/t/unable-to-use-buildkite-agent-meta-data/3954 "2024-10-10T04:48:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajat2911](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@rajat2911](https://forum.buildkite.community/u/rajat2911)\
**Post date:** [October 10, 2024, 4:48am UTC](https://forum.buildkite.community/t/unable-to-use-buildkite-agent-meta-data/3954/1 "2024-10-10T04:48:33Z")

</div>

Hi Team

I have a script , lets say abc.sh  
which has a variable defined

#!/bin/bash

IMAGE\_TO\_DEPLOY=“This is rajat”

Now what i am doing with pipeline is

bash abc.sh  
buildkite-agent meta-data set “my\_image” “$$IMAGE\_TO\_DEPLOY”  
CLOUD\_RUN\_IMAGE=$(buildkite-agent meta-data get “my\_image”)  
echo $$CLOUD\_RUN\_IMAGE

But its not giving the correct output. Please help me on this

---

<div class="post-metadata">

**Author:** ![jykingston](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jykingston](https://forum.buildkite.community/u/jykingston)\
**Post date:** [October 10, 2024, 5:33am UTC](https://forum.buildkite.community/t/unable-to-use-buildkite-agent-meta-data/3954/2 "2024-10-10T05:33:25Z")

</div>

Hey @rajat2911 👋

Welcome to the Buildkite Support Community!

Checking over those Bash snippets I think the only issue here is with having two ‘$’ at the start of your variables, which would give you unexpected output.

I’ve fixed up the script you sent and tested it to make sure it works, give this a go!

```auto
#!/bin/bash
IMAGE_TO_DEPLOY="This is rajat"

# Set metadata
buildkite-agent meta-data set "my_image" "$IMAGE_TO_DEPLOY"
# Get metadata
CLOUD_RUN_IMAGE=$(buildkite-agent meta-data get "my_image")

echo $CLOUD_RUN_IMAGE

```

Thanks!
