[colug-432] Bash script two digit names

Richard Hornsby richardjhornsby at gmail.com
Sun Jan 17 13:07:13 EST 2010


Looks like there might be a printf util that would do the trick. Not  
sure if this meets your builtin requirement.

http://andrewault.blogspot.com/2009/01/padding-numeric-in-bash.html

Sent from my iPhone

On Jan 17, 2010, at 12:40, Tom Hanlon <tom at functionalmedia.com> wrote:

> Colug,
>
> I have a bash script that loops and create files.
>
> THink dates..
>
> I go through and create a file
>
> 01_1 for jan first
> 01_2 for Jan second.
>
>
> Problem is I would much rather have
>
> 01_01 rather than 01_1
>
> The loop goes from 1-31 and sets the variable for the loop counter.
>
> Is there a built in utility to make a "one space" integer a "two
> space" integer, or do I have to do that manually ?
>
> Just curious, I am not stumped, but not looking to reinvent the wheel,
> and would like to use a built in if one is available.
>
> --
> Tom
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432


More information about the colug-432 mailing list