And if the spacing is just being added to the beginning or end ofGotta start using printf to cobble together complicated variables. But in this case it's internal:string1, then don't bother with the spacer variable: # Left-padded printf -v string1 '%*s' $#string2 $string1 # Right-padded printf -v string1 '%-*s' $#string2 $string1