I want to print the list on screen in a readable way. I use a loop to go through each item and create a new list that is formatted with commas and new characters. The problem is that in the first line of the output, I want a header. For example, I want to print something like this:
List: red, green, blue, black, cars, busses, ...
The problem is indenting the second and subsequent lines. I want the padding to be the given length. Therefore, the problem boils down to creating an empty string of a given length. That is, I want the create_empty_line_of_length function, which outputs a given number of spaces.
length=5 echo "start:$(create_empty_line_of_length $length) hello"
In this case, the output should be:
start: hello
Does anyone know how to do this?
string bash
Karl Yngve Lervรฅg
source share