Bash expansion hexadecimal

You can; you just need to break the range {0..F} into two separate ranges {0..9} and {A..F}:

$ printf '%s\n' {{0..9},{A..F}}{{0..9},{A..F}}
00
01
...
FE
EF

Using printf:

$ printf '%.2x\n' {0..255}

The format string %.2x says to format the output as a zero-filled, two-digit, lower-case, hexadecimal number (%02x would have done the same).

If you want upper-case, use %.2X.

Bash only understands base 10 integer ranges or ranges between ASCII characters in brace expansions of intervals.


It's possible but it isn't nice:

echo {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}

As far as I can tell bash has no notion of hex ranges.