vehomzzz vehomzzz - 1 year ago 64
Bash Question

How can I make the list of letters from A to Z and iterate through them in the shell?

Say I want to iterate from letter A to letter Z in csh shell. How do I succinctly do that?

In bash I would do something like

for i in 'A B C ...Z'; do echo $i; done

The point is I don't want to write A through Z, I want something like


Can you suggest a one line suggestion in AWK or Perl?

mob mob
Answer Source


$,=" ";print +(A..Z)

or to use inside a shell:

for i in `perl -e '$,=" ";print +(A..Z)'` ; do echo $i ; done
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download