1

I'm new to programming in general and my teacher is starting me out with simple bash scripts. I would like to do the alphabet in it's own line. For example:

A
B
C

I would like to do the alphabet with out writing the entire alphabet. Ive work with numbers for example:

seq 1 3 | while read a; do
   echo $a
done
Goetia
  • 25
  • 2

2 Answers2

3

Try this:

printf "%s\n" {A..Z}

See: help printf

Cyrus
  • 84,225
  • 14
  • 89
  • 153
1

Here is another way to do it:

echo -e {A..Z}"\n"

And if you want to remove the extra space before each letter, you can use the following:

echo -e {A..Z}"\n" | tr ' ' '\n'
higuaro
  • 15,730
  • 4
  • 36
  • 43