# .drone.yml variable substitution not properly escaped

**URL:** <https://drone.discourse.group/t/drone-yml-variable-substitution-not-properly-escaped/12073>\
**Category:** Drone Support\
**Tags:** variables\
**Created:** [May 24, 2022, 6:39am UTC](https://drone.discourse.group/t/drone-yml-variable-substitution-not-properly-escaped/12073 "2022-05-24T06:39:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stalkyr](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/stalkyr/32/7603_2.png) [@Stalkyr](https://drone.discourse.group/u/Stalkyr)\
**Post date:** [May 24, 2022, 6:39am UTC](https://drone.discourse.group/t/drone-yml-variable-substitution-not-properly-escaped/12073/1 "2022-05-24T06:39:20Z")

</div>

.drone.yml

```auto
  commands:
  # var1 is undefined
  - var2="abcd"
  - echo ${var1:-${var2}}
  # print empty line, which is intended
  - echo ${var1:-$${var2}}
  # print "$", not escaped!
  - echo ${var1:-$var2}
  # print "abcd", which is intended

```

`${var1:-$${var2}}` should pre-process to `${var2}` if var1 is undefined
