Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a database sqlite file called "a.db".

I need to copy it 25 times (once for each letter of the alphabet) to have: b.db, c.db, d.db... ... ... z.db.

How can I do this in the Bash shell?

share|improve this question
up vote 6 down vote accepted

A for loop and brace expansion.

for pref in {b..z}
  cp a.db "$pref.db"
share|improve this answer
mmm .. it not work! I've simply copied and paste your code and run as bash shell... but it create a file: {a..z}.db – stighy Sep 12 '11 at 11:57
I solved using : for pref in q w e r t y u i o p a s d f g h j k l z x c v b n – stighy Sep 12 '11 at 12:04
Then you're not running bash, or you're running an ancient version. – Ignacio Vazquez-Abrams Sep 12 '11 at 20:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.