bashloopsbrace-expansion

looping through uppercase, lowercase and numbers in bash


Here is some code which loops through a-z. I am wondering if there is an equivalent that will loop though the lowercase, uppercase and numbers without using multiple loops.

for i in {a..z}
do
echo $i
done

Solution

  • I suggest

    for i in {a..z} {A..Z} {0..9}
    

    to loop through

    a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9