# Unable to pass a custom variable in balena deploy build args

**URL:** <https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352>\
**Category:** openBalena\
**Tags:** balena-cli\
**Created:** [May 29, 2019, 7:25pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352 "2019-05-29T19:25:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirkbrauer](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@kirkbrauer](https://forums.balena.io/u/kirkbrauer)\
**Post date:** [May 29, 2019, 7:25pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/1 "2019-05-29T19:25:56Z")

</div>

I am attempting to execute a bit of shell script inside my balena deploy build argument, however I continue to receive the error “Could not parse build argument.” What would be the correct format to execute the command and pass the argument successfully?

The command I am currently using in `balena deploy DigitalSignageDisplay --logs --source . --emulated --build --buildArg "'ARG=$(cat ~/file.txt)'"`

---

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [May 29, 2019, 7:33pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/3 "2019-05-29T19:33:36Z")

</div>

Could it be that `file.txt` contains some shell-special characters like a single quote? In which case, it would need to be escaped somehow. Is that the question, how to escape it somehow? 🙂

---

<div class="post-metadata">

**Author:** ![kirkbrauer](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@kirkbrauer](https://forums.balena.io/u/kirkbrauer)\
**Post date:** [May 29, 2019, 7:34pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/4 "2019-05-29T19:34:17Z")

</div>

I know that it contains new lines, but I checked and there are no shell-special characters inside.  
Maybe there is a better way to escape the command so that those don’t cause an issue?

---

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [May 29, 2019, 10:50pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/8 "2019-05-29T22:50:45Z")

</div>

I have found that the balena CLI was testing the ARG value against a regular expression that does not allow newline characters, and I have created a pull request that appears to solve the problem:

- [https://github.com/balena-io/balena-cli/pull/1269](https://github.com/balena-io/balena-cli/pull/1269)

The PR is pending review – reviewers may know of reasons why line break characters should not be allowed. Otherwise, it should get merged and released very soon.

---

<div class="post-metadata">

**Author:** ![kirkbrauer](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@kirkbrauer](https://forums.balena.io/u/kirkbrauer)\
**Post date:** [May 30, 2019, 12:32am UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/10 "2019-05-30T00:32:38Z")

</div>

Awesome! Once again thanks for the quick response. This pull request should help align the CLI with the normal Docker build args argument.

---

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [May 30, 2019, 11:02pm UTC](https://forums.balena.io/t/unable-to-pass-a-custom-variable-in-balena-deploy-build-args/12352/11 "2019-05-30T23:02:14Z")

</div>

The PR was merged and released in CLI version [10.17.2](https://github.com/balena-io/balena-cli/releases). It is now possible use line breaks in the argument value for the `--buildArg` option of the `build` and `deploy` commands.
