> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash Sequence Expression

A sequence expression is a mechanism within Bash's brace expansion phase that generates a contiguous series of integers or characters. It evaluates strictly before other expansions (such as parameter expansion, command substitution, or arithmetic expansion) and produces a space-separated list of discrete string tokens.

```bash theme={"dark"}
{<START>..<END>[..<STEP>]}
```

## Parameters

* **`START`**: The initial boundary value. Must be an integer or a single alphabetic character.
* **`END`**: The terminal boundary value (inclusive). Must match the data type of `START`.
* **`STEP`** *(Optional)*: An integer defining the interval between generated values. Bash evaluates this as an absolute value, ignoring any negative sign. If omitted, Bash defaults to an interval of `1` or `-1`, automatically inferred from the relative values of `START` and `END`.

## Core Mechanics

**Integer Sequences**
Generates a sequence of base-10 integers. It natively supports negative numbers and automatically determines whether to increment or decrement based on the boundaries.

```bash theme={"dark"}

# Ascending
echo {1..5}

# Output: 1 2 3 4 5


# Descending with negative integers
echo {2..-2}

# Output: 2 1 0 -1 -2
```

**Zero-Padding**
If either `START` or `END` is prefixed with a `0`, Bash forces all generated tokens to be zero-padded to match the maximum character width of the provided boundary values.

```bash theme={"dark"}
echo {001..5}

# Output: 001 002 003 004 005

echo {08..11}

# Output: 08 09 10 11
```

**Character Sequences**
Generates a sequence of single characters based on the C locale's lexicographical order (ASCII code points). While the `START` and `END` boundaries must be standard alphabetic characters to trigger the expansion, the generated sequence itself is not strictly alphabetic. Mixing cases (e.g., `{a..Z}`) traverses the ASCII table between the two code points, outputting the non-alphabetic characters (`[`, `\`, `]`, `^`, `_`, `` ` ``) that reside between the uppercase and lowercase ranges.

```bash theme={"dark"}
echo {a..e}

# Output: a b c d e


# Mixed case traversal including non-alphabetic ASCII characters
echo {a..Z}

# Output: a ` _ ^ ] \ [ Z
```

**Step Intervals**
The `STEP` parameter forces the sequence to skip values. Bash evaluates the `STEP` as an absolute difference. Syntactically, Bash accepts negative integers for the step but ignores the negative sign, applying the absolute value regardless of whether the sequence is ascending or descending.

```bash theme={"dark"}

# Integer step
echo {10..0..2}

# Output: 10 8 6 4 2 0


# Negative step value (sign is ignored, evaluated as absolute 2)
echo {1..5..-2}

# Output: 1 3 5


# Character step
echo {a..z..5}

# Output: a f k p u z
```

## Parser Evaluation Constraints

Because brace expansion is the absolute first step in the Bash shell expansion process, sequence expressions are evaluated as strict literals. They cannot dynamically interpolate variables directly.

```bash theme={"dark"}

# This will NOT evaluate as a sequence expression
END=5
echo {1..$END}

# Output: {1..5}
```

To force a sequence expression to evaluate variables, the shell must be instructed to perform a secondary evaluation pass using `eval`, though this requires careful string escaping to prevent premature expansion.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
