Looping over the entire alphabet with old bash

Alec Jacobson

July 29, 2009

weblog/

Working on a mac with an older version of bash (2.05b.0), I found myself deprived of the fancy sequences of bash versions greater than 3.0. Namely {1..100}, {a..z}, etc. Unfortunately, I did not have seq either. Luckily my mac did have jot, so I could implement a loop over the alphabet (lowercase and uppercase) like this:
#!/bin/bash
for x in `jot -c - a z 1` `jot -c - A Z 1`
do
echo $x
done