I have tried several approaches to building a single string for printf to display but always end up not displaying the red spaces and blank spaces following the escape sequences and printing the escape sequences instead. Here is my code:
str3=`echo " " | cut -c $k`
sp=$(( 10 - $k ))
str5=`echo " " | cut -c $sp`
# str=$str1+$str2+$str3+$str4+$str5+$str6 didn't work either
printf "%s" "$str"
How does one use escape sequences in printf above?
BTW I also tried without the "$" in front of the escape code in str2 & 4.