Tired of not finding things in your terminal because there's a lot of logs and garbage? Tired of destroying the Enter key by creating a "void zone" in your terminal so that you can see the error that you're trying to debug?<p>Use the old <hr /> tag, but in your terminal
If you want a solid line, you could use U+2501 (━) from the set of box drawing characters (<a href="https://en.wikipedia.org/wiki/Box-drawing_character" rel="nofollow">https://en.wikipedia.org/wiki/Box-drawing_character</a>):<p><pre><code> <━> 9473, U+2501 BOX DRAWINGS HEAVY HORIZONTAL
hr(){printf '━%.0s' $(seq $COLUMNS)}</code></pre>
Great idea, one random nitpick:<p><pre><code> curl https://raw.github.com/LuRsT/hr/master/hr > ~/bin/hr
</code></pre>
is just evil. That's a great way to own a machine. You can even read the code today, but run the command tomorrow when someone had replaced the code with a giant exploit. Not saying there is a better way to distribute something like this that is as easy to use, but damn, this is just asking for trouble.
This has me wondering, why haven't terminal windows evolved functionally to better support history, scrollback buffers jumping or markers, selection with a mouse, auto-complete hints, etc. Instead we're limited to hacks like this or the screenshot at <a href="http://unix.stackexchange.com/questions/3650/would-it-be-possible-to-jump-between-prev-next-command-prompts" rel="nofollow">http://unix.stackexchange.com/questions/3650/would-it-be-pos...</a> ... and no, I don't think "use emacs" is an acceptable answer ;-)<p>Oh and instead of adding blank lines with "Enter", I often just type "clear" and hit return. Bingo, tons of whitespace now added.
i forked this to do something immature instead because i'm 12 years old.<p>$ dong
8=================================D # Till the end of your terminal window
$<p><a href="https://github.com/tgrochowicz/hr" rel="nofollow">https://github.com/tgrochowicz/hr</a>
Some other characters you may want to substitute into the script:<p>――――――――――――――――――――――――――――――――――――――――――――――――――<p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<p>┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅<p>██████████████████████████████████████████████████
Great little script. I tossed it into by bash functions and added a bit of error checking and output formatting: <a href="https://github.com/jamestomasino/bash-scripts/blob/master/.functions#L159-L174" rel="nofollow">https://github.com/jamestomasino/bash-scripts/blob/master/.f...</a>
I like to use terminal colors so it's red, as well as allowing controlling width, but defaulting to terminal width.<p><pre><code> $ cat ~/bin/br
#!/bin/sh
if [ "$1" == "" ] ; then
COLS=`tput cols`
elif [ "$1" == "--help" ] ; then
echo "$0: Prints a red line across the screen. or $0 <##> for a specific width."
echo "$0: br ; grep -ir foo * -- place a marker to see where results begin / end."
echo "$0: br 80 ; cat file -- use to check for overly long lines."
exit
else
COLS=$1
fi
LINE=""
for (( x=0 ; x<$COLS ; x++ )); do LINE="$LINE-" ; done
echo -e '\E[47;0m'"\033[1m$LINE\033[0m"</code></pre>
I'm interested why they use "seq"? [seq can take a single value too apparently, perhaps they did half width rulers with "seq 2 $(tputs cols)"?]<p>Why doesn't<p><pre><code> !/bin/bash
j=$(tput cols); for i in {1..$j}; do echo -n "#";done
</code></pre>
work, presumably there's some escape that needs doing?<p>The alternative:<p><pre><code> !/bin/bash
for (( c=1 ; c<=$COLUMNS; c++ )); do echo -n "#";done
</code></pre>
seems fine?<p>Also BASH has $COLUMNS builtin FWIW, though portability explains use of tput.<p>I like it, should be a standard command, including options to specify width as a proportion and to add whitespace lines. Code for this must be in almost every shell script.
If you like this idea and are stuck in Windows, this does the same thing:<p><pre><code> @set @jScript=1;/*
@for /f "tokens=1,2" %%w in ('mode con:') do @if "%%w" == "Columns:" set cols=%%x
@cscript /noLogo /E:jScript "%~f0" %cols% %1 =
@Goto :EOF
*/line='';while(line.length<WScript.Arguments(0))line+=WScript.Arguments(1);
WScript.StdOut.Write(line.substr(0,WScript.Arguments(0)));
</code></pre>
Save as hr.cmd and stick it somewhere in your path.