The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 02-06-2007
radoulov's Avatar
radoulov radoulov is online now Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,918
Or without external commands (like expr):

ksh

Code:
i=0000010000;n=$(printf "%010d" $((i+1)))

bash

Code:
i=10#0000010000;n=$(printf "%010d" $((i+1)))

With newer versions of bash:

Code:
i=10#0000010000;n=$(printf "%010d" $((++i)))