---
title: Missing spaces around comparison operator
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Missing spaces around comparison operator
---

# Missing spaces around comparison operator

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ().
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `bash-code-quality/missing-spaces-around-comparison-operator`

**Language:** Bash

**Severity:** Notice

**Category:** Code Style

## Description{% #description %}

In Bash `[[ ... ]]`, comparison operators such as `=` and `==` must be separate tokens with spaces on both sides. If they are glued to operands (e.g. `[[ 0=1 ]]`), the shell does not treat them as operators: `[[ 0=1 ]]` is equivalent to `[[ -n 0=1 ]]` (non-empty string), not an equality test. This rule detects that glued form when it parses as a single word.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```bash
#!/bin/bash
[[ 0=1 ]]
[[ a==b ]]
```

## Compliant Code Examples{% #compliant-code-examples %}

```bash
#!/bin/bash
[[ 0 = 1 ]]
[[ foo ]]
[[ a == b ]]
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 