in reply to Printing a specified number of characters
printf "%${number}s %${number_two}s\n", 'A', 'B';
The variable name needs to be enclosed in curly braces to stop the interpreter from looking for the variables named $numbers and $number_twos. The idea is that %20s will print a value in a right-justified field of length 20. Rather than hard-coding the 20, we pick it up from a variable.
|
|---|