I need a command that will draw a horizontal "line" in the terminal. The line must be exactly the width of the terminal long (regardless of a current terminal width) and consist of a dash character (although a unicode symbol for a horizontal line can be also used).
It is better if it can be colored.
I need to use it like this:
echo some text
drawline
echo more text
And the output would look something like this:
echo some text
---------------------------------------------------------------------------------
echo more text
In man bash , at the end of the single-character options there is:- -- A -- signals the end of options and disables further option processing.
Printing Newline in Bash The most common way is to use the echo command. However, the printf command also works fine. Using the backslash character for newline “\n” is the conventional way.
Try with:
echo some text
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo some text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With