bash scripting: problem with generating filenames
Before the problem: I am completely new to bash (been writing it for about 2 weeks), and now I have been stuck with this problem for more than 3 hours now, though most probably the solution is elementary...
The problem: I need to rename files so that the names would be 001 002 003 ... 010 ... 011 ... 198 etc. (all the names must be 3 characters long, yep, i'm sure there wount be more than 999 files)
It is obvious I just have to have a variable that has a 1 added to it in every step of the loop, but what do I do to get the zeros in the beggining of the variable outputed? Note that the number of '0' changes so I can't do like this:
Can somebody PLEASE tell me how to generate the numbers (the '0' at the beggining of the finenames are important)? I could easily do this in c++, but now I feel completely stuck... I just can't think of a good way to do this in bash... PLEASE HELP!
Last edited by mad_juno; 07-22-2005 at 10:09 AM.