On the Bash programming language (scripting language) command line on Linux PC/server, this is about how to implement commands to cleanly output horizontal lines and strings.

printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
# or
stty size | perl -ale 'print "-"x$F[1]'
I define it as a function like below so I can specify the delimiter.
horizonal_line(){
: horizonal_line [delimiter]
: e.g. horizonal_line "="
# stty size | perl -ale 'print "-"x$F[1]'
stty size | perl -ale "print \"${1:-"-"}\"x\$F[1]"
}
$ horizonal_line "*"
***********************************************************************************************
$ horizonal_line "="
===============================================================================================
$ horizonal_line "+"
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$ horizonal_line "#"
###############################################################################################
$ horizonal_line
-----------------------------------------------------------------------------------------------