# Command passed as variable always fails

**URL:** <https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111>\
**Category:** Build Environment\
**Created:** [May 20, 2016, 8:30am UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111 "2016-05-20T08:30:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![barbushin](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/barbushin/32/3000_2.png) [@barbushin](https://discuss.circleci.com/u/barbushin)\
**Post date:** [May 20, 2016, 8:30am UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111/1 "2016-05-20T08:30:06Z")

</div>

There is cyrcle.yml:

```
deployment:
  development:
    branch:
      - develop
    commands:
      - ${DEPLOY_STAGING_COMMAND}

```

And `DEPLOY_STAGING_COMMAND` is defined in Environment variables with value:

```
ssh ubuntu@54.165.245.171 "cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev"

```

Result always fails with error:

```
Warning: Permanently added '54.165.245.171' (ECDSA) to the list of known hosts.
bash: cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev: No such file or directory
${DEPLOY_STAGING_COMMAND} returned exit code 127
Action failed: ${DEPLOY_STAGING_COMMAND}

```

But if I replace ${DEPLOY\_STAGING\_COMMAND} with original value in cyrcle.yml, like this:

```
deployment:
  development:
    branch:
      - develop
    commands:
      - ssh ubuntu@54.165.245.171 "cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev"

```

It works fine! Also it works if I replace some string with variables:

```
deployment:
  development:
    branch:
      - develop
    commands:
      - ssh ${DEPLOY_USER}@${DEPLOY_SERVER} "cd ${DEPLOY_PATH} && git pull && composer install --prefer-dist --no-dev"

```

But, in my case, I need to customize deploy command from CircleCI project settings GUI.

Is there anybody who can explain why CircleCI fails with `No such file or directory` error when binding deploy command to `${DEPLOY_STAGING_COMMAND}` variable?

Thank you!

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [May 20, 2016, 8:37pm UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111/2 "2016-05-20T20:37:38Z")

</div>

> [@barbushin](#):
>
> And DEPLOY\_STAGING\_COMMAND is defined in Environment variables with value:

Is this done via the Environment Variables page on the website? Or somewhere else?

---

<div class="post-metadata">

**Author:** ![barbushin](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/barbushin/32/3000_2.png) [@barbushin](https://discuss.circleci.com/u/barbushin)\
**Post date:** [May 21, 2016, 7:01am UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111/3 "2016-05-21T07:01:49Z")

</div>

> Is this done via the Environment Variables page on the website? Or somewhere else?

Exactly. From Environment Variables page on website.

---

<div class="post-metadata">

**Author:** ![barbushin](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/barbushin/32/3000_2.png) [@barbushin](https://discuss.circleci.com/u/barbushin)\
**Post date:** [October 19, 2016, 8:18am UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111/4 "2016-10-19T08:18:18Z")

</div>

And there is solution:

```auto
deployment:
  development:
    branch:
      - develop
    commands:
      - eval ${DEPLOY_STAGING_COMMAND}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:32am UTC](https://discuss.circleci.com/t/command-passed-as-variable-always-fails/4111/5 "2018-06-18T11:32:05Z")

</div>


