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?

link|improve this question

feedback

1 Answer

up vote 6 down vote accepted

A for loop and brace expansion.

for pref in {b..z}
do
  cp a.db "$pref.db"
done
link|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
feedback

Your Answer

 
or
required, but never shown

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