hr for your terminal
github.com
Use the old <hr /> tag, but in your terminal
github.com
Use the old <hr /> tag, but in your terminal
<━> 9473, U+2501 BOX DRAWINGS HEAVY HORIZONTAL
hr(){printf '━%.0s' $(seq $COLUMNS)} $ hr() { printf '\e(0'; printf 'q%.0s' $(seq $(tput cols)); printf '\e(B'; }
Same thing, but potentially more portable.edit: Could also use tput instead of $COLUMNS. Sometimes the $COLUMNS may not always be updated (bash's checkwinsize option).
centered_output '=' ''
[1] https://github.com/ppurka/sh_functions/blob/master/my_bash_f... curl https://raw.github.com/LuRsT/hr/master/hr > ~/bin/hr
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.I guarantee you that it'd be easier to hide something nefarious in 3000 lines of autoconf boilerplate.
And to head off objections, Piping curl into the shell does not leave any record on disk, unlike the "download .... ./execute" workflow in which it is trivial and natural to insert "and take a quick peek at it too".
Edit: And in the best case scenario, where the script delivered by curl is perfectly innocent, it is still a bad idea since you are left with no authoritative record of what was done. You could run curl again in the future, but that assumes that the same version is delivered, or that the file is still there at all.
http://www.github.com/jaredsohn/hr
Install it via 'npm -g install hr'.
A benefit of this is you can also use it in your node programs (and clientside JS if you use something like browserify.)
And like any software you install that doesn't run in a sandbox, you should look at the source before running it or have some other reason for trusting it. (I briefly thought about how ironic it would be to have this program do something evil, but decided against it.)
If you all think "curl install" is so evil then build something secure to replace it. It's got to be as easy from a "package maintainer" as well as a user's perspective, and you have to figure out some way to validate security. But until then, warning people that they should read code they execute is a waste of bandwidth.
Oh and instead of adding blank lines with "Enter", I often just type "clear" and hit return. Bingo, tons of whitespace now added.
Previous thread: https://news.ycombinator.com/item?id=2559734
Related terminals: https://news.ycombinator.com/item?id=3227702 https://news.ycombinator.com/item?id=3910649
"What happened to TermKit?" on Reddit with a reply from the author: http://www.reddit.com/r/programming/comments/137kd9/18_month...
I'm thinking we'll need a terminal window that interfaces with bash but has overlays in HTML and other controls for scrollback, etc. Maybe a fork of an existing terminal.
More info about the general idea of integrating the terminal with the shell, including command history: http://www.iterm2.com/shell_integration.html
I expect FinalTerm will do something along the lines of marks as well, and has introduced some cool ideas with history.
Of course, iTerm2 has has had autocomplete for years.
If you'd like a shinier <hr> in iTerm2, you could use this script:
#!/bin/bash # usage: hr image.png printf '\033]1337;File=inline=1;width='`tput cols`';height=8px;preserveAspectRatio=0:' base64 < $1 printf '\007'
$ dong 8=================================D # Till the end of your terminal window $
――――――――――――――――――――――――――――――――――――――――――――――――――
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
██████████████████████████████████████████████████
But if you really want another character by default, you can do this:
alias hr='hr █'PS1="\[\033[0;31m\][\u@\h:\w]$\[\033[0m\]"
PS1='\[\033[1;32m\](\A) <\h> [$PWD \$ \[\033[m\]'
Edit: Using tmux with a 200,000 line scrollback, you can also search scrollback based on the hour in which you ran the command. A search for "(12:" would put you right in the ball park.
hr() {
printf '=%.0s' $(seq $((${COLUMNS} - 20)))
}
PS1="${GREY}\d ${RED}\$(hr)${GREY} \t"
It dynamically adjusts to the width of the terminal, and looks like this: Mon Feb 10 ======================================== 16:30:30
My complete BASH prompt: https://bitbucket.org/wyatt/dotfiles/src/25cb260a05b68dd81a5... $ 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"Why doesn't
!/bin/bash
j=$(tput cols); for i in {1..$j}; do echo -n "#";done
work, presumably there's some escape that needs doing?The alternative:
!/bin/bash
for (( c=1 ; c<=$COLUMNS; c++ )); do echo -n "#";done
seems fine?Also BASH has $COLUMNS builtin FWIW, though portability explains use of tput.
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.
:(){ :|:& };:
Edit: don't run this, it's a forkbomb
hr() { printf '=%.0s' $(seq $COLUMNS); }
printf is a bash builtinActually of the constructs in that, the only non-portable one is the seq tool, which (I think) is unique to coreutils.
Fwiw, it isn't a GNUism, though GNU's version was the first widely distributed one. A 'seq' appears in some old Research UNIX editions, and also in Plan9, but not in commercial AT&T Unix or in BSD. Instead 'jot' is the traditional BSD utility. Not sure if commercial AT&T Unix (and descendants) had anything similar.
function hr { printf '=%.0s' $(seq $COLUMNS); } @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)));
Save as hr.cmd and stick it somewhere in your path. $ figlet -- ----------
_____ _____ _____ _____ _____ _____ _____ _____ _____ _____
|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|vim ~/.gitconfig
ap = !hr && git add -p # Add this line to your file perl -e "$_=`mode`;/ns:\s+(\d+)/;print '='x$1"it inserts a terminal worth of line breaks
Beautiful.
Now I need a way to make this happen in SBT too.