title: Zero-padding a string/file name in shell script
body: <p>I am making files numbered 1-1000. I need to have the files printed out such that the <strong>first one</strong> is <code>0000.txt</code>, <strong>the second</strong> <code>0001.txt</code>, and the <strong>hundredth and first</strong> will be <code>0100.txt</code>, etc. </p>
  
  <p>What command would accomplish the same thing as the printf format <code>%04d</code> in c?</p>
  
  <p>Edit: I'm running everything on Mac OSX, and using bash in terminal. Too be fair I have no idea what POSIX is, or even what a shell is. Sorry I didn't specify my system earlier.</p>