Re: repeating a character a variable number of times



On 2010-08-21, Wayne wrote:
....
The '%*d' of printf is not portable, or at least not part of
the POSIX standard.

Look again. It *is* in the standard.

You need to use eval for this in shell:
eval printf "%0${count}d" 0

eval is not necessary (try it and see).

--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)

.



Relevant Pages