# /bin/sh: syntax error: unexpected ";"

**URL:** <https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449>\
**Category:** Pipeline Steps\
**Created:** [October 8, 2020, 11:24am UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449 "2020-10-08T11:24:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yair\_Fried](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/yair_fried/32/288_2.png) [@Yair\_Fried](https://community.codefresh.io/u/Yair_Fried)\
**Post date:** [October 8, 2020, 11:24am UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/1 "2020-10-08T11:24:19Z")

</div>

We keep getting this failure message on various freestyle steps. Usually when there are several multiline commands.  
Seems like something is off with either the yaml parser or the CF execution.

```
  commands:
    - set -x
    - |
      if [["${MONITORING_ONLY}" = "true"]]; then
        cf_export SINGLE_CLUSTER="primary"
        exit 0
      fi
      if [[-z "${SERVICE_NAMESPACE// }"]]; then
        cf_export MIGRATE_EXISTING="true"
      else
        cf_export MIGRATE_EXISTING="false"
        exit 0
      fi
    - echo "hello world"
    - apk add --update jq pcre-tools && rm -rf /var/cache/apk/*
    - ./script.sh

```

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [October 12, 2020, 8:25am UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/2 "2020-10-12T08:25:00Z")

</div>

Hello.

What is the URL of the build that has the issue?

---

<div class="post-metadata">

**Author:** ![bzlee](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/bzlee/32/592_2.png) [@bzlee](https://community.codefresh.io/u/bzlee)\
**Post date:** [April 20, 2023, 11:56am UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/3 "2023-04-20T11:56:49Z")

</div>

Just missing a `-`:

```auto
  commands:
    - set -x
    - |-
      if [["${MONITORING_ONLY}" = "true"]]; then
        cf_export SINGLE_CLUSTER="primary"
        exit 0
      fi
      if [[-z "${SERVICE_NAMESPACE// }"]]; then
        cf_export MIGRATE_EXISTING="true"
      else
        cf_export MIGRATE_EXISTING="false"
        exit 0
      fi
    - echo "hello world"
    - apk add --update jq pcre-tools && rm -rf /var/cache/apk/*
    - ./script.sh

```

---

<div class="post-metadata">

**Author:** ![divyang.betcloud](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/divyang.betcloud/32/588_2.png) [@divyang.betcloud](https://community.codefresh.io/u/divyang.betcloud)\
**Post date:** [April 24, 2023, 4:21am UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/4 "2023-04-24T04:21:59Z")

</div>

Well Well Well !! It just took 3 years to be fixed! 😛

---

<div class="post-metadata">

**Author:** ![sam-nash](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/sam-nash/32/611_2.png) [@sam-nash](https://community.codefresh.io/u/sam-nash)\
**Post date:** [August 9, 2023, 1:24pm UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/5 "2023-08-09T13:24:59Z")

</div>

@Kostis  
Is there a solution to this problem. I tried the above suggestion but it didn’t work.

```auto
version: '1.0'

steps:
  my_step:
    title: My Step
    image: my-image
    commands:
      - var='value' # from an expression 
//some other 10 commands 
      - |
        if ["$var" = "true"]; then
          echo "success"
        else
          echo "fail"
          exit 1
        fi

```

/bin/sh: syntax error: unexpected “;”

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [August 9, 2023, 3:06pm UTC](https://community.codefresh.io/t/bin-sh-syntax-error-unexpected/449/6 "2023-08-09T15:06:08Z")

</div>

It is hard to debug this here.

Please open a support ticket and be sure to include the URL of the build that has the issue.

Thank you
