Guest iwra Posted May 8, 2006 Report Share Posted May 8, 2006 (edited) if i was using '$(( $i + 1 ))' to try and increase a double digit number, for example '01', it would then result as '2'. how do i make it increase to '02'? if i manually inserted a '0' in the code, it would not work properly past 09 since it would appear as 010 as the next digit. please help. Edited May 8, 2006 by iwra Quote Link to comment Share on other sites More sharing options...
tyme Posted May 8, 2006 Report Share Posted May 8, 2006 what are your writing this in? i assume bash script...? Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted May 8, 2006 Report Share Posted May 8, 2006 (edited) printf "%02.0f\n" $(( $i + 1 )); That outputs the number how you want it. If you are more specific what you are using this for, I may be able to help more. Edit: I assumed bash. Edited May 8, 2006 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
Guest iwra Posted May 8, 2006 Report Share Posted May 8, 2006 yes, bash. sorry i forgot to mention. thanks for the help, Steve Scrimpshire. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.