My aim is to echo a character, for example #, based on a value such as num=6 and it must print # 6 times on the screen.
Not sure how to get this.
My aim is to echo a character, for example #, based on a value such as num=6 and it must print # 6 times on the screen.
Not sure how to get this.
 
    
     
    
    You could do something like
 printf '#%.0s' {1..6}
or, in the more general case,
 printf '#%.0s' $(seq 1 $num)
 
    
    printf "%*s" "$num" " " | tr " " "#"
or
yes '#' | head -"$num" | tr -d "\n"
