in reply to redirect stream from wirte; to $string
sprintf and printf are your huckleberries...
The first argument is the format specification, which is then followed by a list of variables that directly correspond to the "placeholders" specified in the format.
For example,
printf "%05d", 32; # prints an integer 5 digits wide, with leading ze +roes, ie. 00032 printf "%32s", 'foo'; # prints the word 'foo' into an area 32 characte +rs wide
This doesn't even begin to scratch the surface of what sprint and printf do, but it is a place to start.
|
|---|