Skip to content
Advertisement

Print the alphabet in bash

I would like help with the following algorithm in bash (or anything accessible through bash shell): I give a number to some function, and based on that number I obtain a string of alphabet letters. Example:

JavaScript

I do not wish to occupy more memory than I need, so approaches such as for i in {A..Z} or echo {A..Z} or echo {A..Z}{A..Z} are not viable here. The closest I’ve managed to get is to find out how long is the sequence of letters for a particular number through the following expression:

JavaScript

After that, I am stuck. A little help?

Advertisement

Answer

Try this script:

JavaScript

Example output:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement