I'm having trouble making a string out of repeated single characters. This works when I'm not assigning it to a variable:
printf "*%.0s" $(seq 1 $(expr $1 / 2))
This just assigns the script name to test:
printf -v test "*%.0s" $(seq 1 $(expr $1 / 2))
I also tried:
test=$(printf "*%.0s" $(seq 1 $(expr $1 / 2)))
But it does the same thing.
Why doesn't this work, and is there another way to build a string and assign it to a variable?
testto contain $1 / 2 asterisks. (i.e. "****" if $1 / 2 results in 4)test=$(echo "${testprep// /*}")printf -v test "*%.0s" $(seq 1 $(expr $1 / 2))code? It works fine for me.