Bash expansion hexadecimal

bashbrace-expansionhexnumeric data

I would like to know if there is a way of using bash expansion to view all possibilities of combination for a number of digits in hexadecimal. I can expand in binaries

In base 2:

echo {0..1}{0..1}{0..1}

Which gives back:

000 001 010 011 100 101 110 111

In base 10:

echo {0..9}{0..9}

Which gives back:

00  01 02...99

But in hexadecimal:

echo {0..F}

Just repeat:

{0..F}

Best Answer

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
Related Question