Well, mixed up your var names. This is what I meant: spacer=$(printf "%${diff}s" '') On Mon, May 6, 2024 at 6:33 PM Mark J. Reed wrote: > printf "%${spacer}s" "" ? > > Mark J. Reed > > > On Mon, May 6, 2024 at 18:04 Ray Andrews wrote: > >> So I want to adjust the length of string1. I do this by inserting a >> spacer in string1 who's length is calculated from the length of string2: >> >> local diff spacer >> (( diff = $#string2 - 76 )) >> for (( dd=1; dd> ... # spacer will be incorporated into string1, not shown. >> >> It works fine, but I'll bet there's a less laborious way -- some way of >> creating 'spacer' with 'diff' number of spaces without the for loop. I >> could make 'spacer' too long and then cut it at an index [diff], but I >> doubt that's as simple as it could be. I know it's there, I just can't >> quite remember. >> >> >> -- Mark J. Reed