# Unable to escape backtick in pipeline commands

**URL:** <https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399>\
**Category:** Drone Support\
**Created:** [May 17, 2019, 6:08pm UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399 "2019-05-17T18:08:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexMichaelJonesNC](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alexmichaeljonesnc/32/2863_2.png) [@AlexMichaelJonesNC](https://drone.discourse.group/u/AlexMichaelJonesNC)\
**Post date:** [May 17, 2019, 6:08pm UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399/1 "2019-05-17T18:08:17Z")

</div>

I seem to be unable to escape backticks in commands in a drone pipeline (v0.8). None of the commands below seem to work and yield the usual error: “/bin/sh: syntax error: EOF in backquote substitution” - I’ve tried different counts of backticks, backslashs, and other odd ways of escaping the backticks. I can probably resolve the issue by writing my commands as a script, but I feel like this should be able to be escaped without needing to go down into another shell script.

pipeline:  
test-escape:  
group: start  
image: alpine  
commands:  
- echo ‘```Console’  
- echo ‘```Console’  
- echo ‘\`\\`\`Console' - echo '\\\`\`\`Console’

---

<div class="post-metadata">

**Author:** ![slinstaedt](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/slinstaedt/32/5250_2.png) [@slinstaedt](https://drone.discourse.group/u/slinstaedt)\
**Post date:** [June 22, 2020, 1:22pm UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399/2 "2020-06-22T13:22:58Z")

</div>

Had the same problem right now. Workaround for now was to externalize the script from .drone.yml to myscript.sh and call the later from .drone.yml.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [June 22, 2020, 3:16pm UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399/3 "2020-06-22T15:16:52Z")

</div>

Instead of escaping, you can use a yaml [scalar](https://yaml.org/spec/1.2/spec.html#id2760844). For example:

```auto
commands:
- |
  echo `hello world`

```

---

<div class="post-metadata">

**Author:** ![slinstaedt](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/slinstaedt/32/5250_2.png) [@slinstaedt](https://drone.discourse.group/u/slinstaedt)\
**Post date:** [June 26, 2020, 4:40am UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399/4 "2020-06-26T04:40:49Z")

</div>

Good point. Thanks, Brad.

---

<div class="post-metadata">

**Author:** ![tonglil](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/tonglil/32/4225_2.png) [@tonglil](https://drone.discourse.group/u/tonglil)\
**Post date:** [January 23, 2023, 8:04pm UTC](https://drone.discourse.group/t/unable-to-escape-backtick-in-pipeline-commands/10399/5 "2023-01-23T20:04:34Z")

</div>

Trying to print ``` to post a markdown comment, but there seems to be some kind of parsing that’s going on that makes odd number backticks not work, with or without scalars:

```yaml
---
kind: pipeline
type: docker
name: even

clone:
  disable: true

steps:
  - name: works
    image: alpine:latest
    commands:
      - |
        printf "\`\`" > scalar.txt
      - cat scalar.txt
      - printf "\`\`" > reg.txt
      - cat reg.txt
---
kind: pipeline
type: docker
name: odd

clone:
  disable: true

steps:
  - name: broken
    image: alpine:latest
    commands:
      - |
        printf "\`\`\`" > scalar.txt
      - cat scalar.txt
      - printf "\`\`\`" > reg.txt
      - cat reg.txt

```

event pipeline

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/d/d75acb605e021e66da50fb716824f42932002d5d.png)  
odd pipeline  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/c/c246cea39bf21c8e0a0a30f9048a2c14b5285119.png)
